$@ might not be a true value :) or other things, see Try::Tiny and Devel::EvalError for a description of the possible issue
eval { execeptionalWithoutReturnValue(); 1; } or do { my $exception = $@; ... };
Or
use Try::Tiny; try { execeptionalWithoutReturnValue(); } catch { warn "caught error: $_"; # not $@ };
Or
use Devel::EvalError(); my $ee = Deval::EvalError->new(); $ee->ExpectOne( eval { execeptionalWithoutReturnValue(); 1; } ); if( $ee->Failed() ) { # if ( ! $ee->Succeeded() ) ... $ee->Reason() ...; }
In reply to Re^2: A couple questions about object oriented Perl programming: inheritance and error handling (eval $@ truth)
by Anonymous Monk
in thread A couple questions about object oriented Perl programming: inheritance and error handling
by ted.byers
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |