X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fautodie%2Fexception.pm;h=8646099c4c8595d574f363939807b6c96cebce96;hb=c068db90a348a4c0767ea0a2a8ba5e571290d2c5;hp=b04c82ad036229b8e9cd94dad2e889a8686ce759;hpb=02b13d1d542bbe5c0b940a475065f8e25e0d6722;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/autodie/exception.pm b/lib/autodie/exception.pm index b04c82a..8646099 100644 --- a/lib/autodie/exception.pm +++ b/lib/autodie/exception.pm @@ -14,7 +14,7 @@ use overload use if ($] >= 5.010), overload => '~~' => "matches"; -our $VERSION = '2.05'; +our $VERSION = '2.06_01'; my $PACKAGE = __PACKAGE__; # Useful to have a scalar for hash keys. @@ -170,6 +170,18 @@ set on failure. sub errno { return $_[0]->{$PACKAGE}{errno}; } +=head3 eval_error + + my $old_eval_error = $E->eval_error; + +The contents of C<$@> immediately after autodie triggered an +exception. This may be useful when dealing with modules such +as L that set (but do not throw) C<$@> on error. + +=cut + +sub eval_error { return $_[0]->{$PACKAGE}{eval_error}; } + =head3 matches if ( $e->matches('open') ) { ... } @@ -698,6 +710,7 @@ sub _init { $this->{$PACKAGE}{context} = $args{context}; $this->{$PACKAGE}{return} = $args{return}; + $this->{$PACKAGE}{eval_error} = $args{eval_error}; $this->{$PACKAGE}{args} = $args{args} || []; $this->{$PACKAGE}{function}= $args{function} or