in reply to Re^2: Prototype "foo {...} bar {...}" is documented?
in thread Prototype "foo {...} bar {...}" is documented?

Just to note: you can throw an error object with die. You can throw anything with die.

eval { die new MyException("foo"); }; if (UNIVERSAL::isa($@, 'MyException') { print "Then my example worked!" }

Ted Young

($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)

Replies are listed 'Best First'.
Re^4: Prototype "foo {...} bar {...}" is documented?
by nothingmuch (Priest) on Nov 22, 2004 at 16:27 UTC
    That's exactly what I mean. =)

    But don't use UNIVERSAL::isa, that makes overridding ->isa hard.

    -nuffin
    zz zZ Z Z #!perl

      Using just $@->isa(...) on the other hand errors if $@ isn't an object.

      So I guess you're down to a combination with &blessed from Scalar::Util: blessed($@) and $@->isa(...).

      ihb

      See perltoc if you don't know which perldoc to read!
      Read argumentation in its context!

        That's what I use...

        Although it's longer, it doesn't breack for the various funky objects that exist on CPAN, like Test::MockObject, Object::Realize::Later, and so forth.

        -nuffin
        zz zZ Z Z #!perl