in reply to Re: Error Handling Misconception
in thread Error Handling Misconception
Why did you expect it to do anything else? Your inner eval caught the first exception, but instead of propagating it, you discarded it and printed "hi". The outer eval saw no error, becauase the iner eval ignored it.
This program behaved exactly as expected.
If you wanted the this to do something else, the followingin (untested) would have been better:
--Bob Niederman, http://bob-n.comsub main { my $val = eval { test_sub () }; die "hi" if $@; }
All code given here is UNTESTED unless otherwise stated.
|
|---|