$@ 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() ...;
}