Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: return undef

by Thilosophy (Curate)
on May 23, 2005 at 04:38 UTC ( #459442=note: print w/ replies, xml ) Need Help??


in reply to Re: return undef
in thread return undef

Another useful feature of raising exceptions is that you can pass along the actual error message, which makes debugging much easier.

open $fh, ">$filename" or die "could not open '$filename' for writing: $! "
Also, if you do not write code to catch the exception, your program will terminate with a more meaningful message than "Use of uninitialized value at ... ".


Comment on Re^2: return undef
Download Code
Re^3: return undef
by gaal (Parson) on May 23, 2005 at 05:02 UTC
    die now takes more than just strings. You can use first-class objects if you like. This lets you add more structured information about the exception, which also makes catch/propagate decisions less kludgy to implement.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (16)
As of 2015-07-06 17:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (77 votes), past polls