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

Re: Re: Error Handling Misconception

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.