in reply to Error::Simple or eval{} use to capture &Carp::croak

croak - die of errors (from perspective of caller)
croak is handled using eval{} and error is found by $@.
I have no idea what you mean by "Error objects" but to give you a better idea of how Carp works, take a look at the source.

What did the Pro-Perl programmer say to the Perl noob?
You owe me some hair.

Replies are listed 'Best First'.
Re^2: Error::Simple or eval{} use to capture &Carp::croak
by Anonymous Monk on Sep 04, 2009 at 11:50 UTC

    Written earlier, emphasis added ...

    ... Error::Simple subclasses (Error objects henceforth) ...

    ... as in ...

    # In ModErr.pm ... package ModErr; use base 'Error::Simple'; 1; # Elsewhere ... use ModErr qw[ :try ]; try { 1 == int( rand(2) ) ? call_me() : wont_you_call() ; } catch ModErr with { my ( $err ) = @_; my $text = $err->text; throw ModErr "No call back." unless $text =~ /your call/i; }; print "Everything is ok after all!\n"; sub call_me { throw ModErr "Here is your call!"; } sub wont_you_call { throw ModErr 'please?'; }