Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: eval failure does not set $@by perl-diddler (Chaplain) |
on Jun 06, 2018 at 20:30 UTC ( [id://1216055]=note: print w/replies, xml ) | Need Help?? |
eval sets "$@" with the output of what you'd normally see perl output if there were errors compiling your program.
perl normally wouldn't display runtime errors if a subroutine doesn't do what it is supposed to do. eval won't either. If the routines you are running return a status, then you want to catch that status coming back from eval:
$status should be '7'. Only if the code you are executing "dies" or throws a warning, in the perl sense, would eval return something in $@. Does that help?
In Section
Seekers of Perl Wisdom
|
|