X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fautodie%2Fexception.pm;h=8646099c4c8595d574f363939807b6c96cebce96;hb=7840a289bfa1b7a230055bb32f02d6873672b75b;hp=ac578a172288bdf61cf4f0b0ad93b828f1e6e536;hpb=636a19183afddcfee3e377f79668687caee21a8f;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/autodie/exception.pm b/lib/autodie/exception.pm index ac578a1..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.06'; +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