Slash Boxes
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.
More | Login | Reply
Loading... please wait.
  • That bit of code supposedly from Exception::Class is just an example of something you could do in the pod. It's not actually in the code itself. I'm not insane.
  • I'll take that as one vote to release the developer version as stable, then.

  • You surely mean of course (defined $it and blessed $it and $it->isa('Foo'))...
    • 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.

    • No, I think you meant

      defined( blessed $it ) and $it->isa( '...' )
      . blessed() is not a sufficient boolean on its own. There are two false classes in perl.