Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Re: Error Handling Misconception

by bobn (Chaplain)
on Sep 06, 2003 at 14:52 UTC ( #289468=note: print w/replies, xml ) Need Help??

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:

sub main { my $val = eval { test_sub () }; die "hi" if $@; }

--Bob Niederman,

All code given here is UNTESTED unless otherwise stated.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://289468]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2020-05-31 10:08 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (173 votes). Check out past polls.