Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: Re: Error Handling Misconception

by bobn (Chaplain)
on Sep 03, 2003 at 23:10 UTC ( #288763=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Error Handling Misconception
in thread Error Handling Misconception

works for me:

my $object = new wierd; my $value = eval { $object->next_value() }; if ($@) { print "BLAH!\n$@\BLAH!\n"; } print $value, "\n"; package wierd; sub new { bless {}, shift} sub next_value { die "badness"; }
Produces:
BLAH! badness at ./tstprog.pl line 13. BLAH!

Are you sure you're in a situation where you can see what's printed? What happens when the routine works and $value is something printable?

--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
Node Status?
node history
Node Type: note [id://288763]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2020-05-25 15:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (146 votes). Check out past polls.

    Notices?