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

Re: Re: Error Handling Misconception

by bobn (Chaplain)
on Sep 06, 2003 at 14:52 UTC ( [id://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, http://bob-n.com

All code given here is UNTESTED unless otherwise stated.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-25 08:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found