Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • You surely mean of course (defined $it and blessed $it and $it->isa('Foo'))...
    • by Ovid (2709) on 2007.12.08 20:37 (#59351) Homepage Journal

      That's a lot longer to type and while it's theoretically clearer, I don't think it wins over an eval. Did I miss something obvious?

      • In general, using eval willy nilly is not good because you might swallow an exception that should have bubbled up. But a properly working isa is not expected to throw exceptions (or so I hope), so this idiom seems just fine.

        • You're absolutely right. An overridden isa() that throws an would violate the Liskov substitution principle, so it would not in fact work properly.