Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: comprehensive error handling

by dragonchild (Archbishop)
on Jul 16, 2003 at 18:59 UTC ( [id://274985]=note: print w/replies, xml ) Need Help??


in reply to comprehensive error handling

use Error qw(:try); use Error::File; # This is something you write use IO::File; # Stuff here ... my $fh = try { IO::File->new($filename) || throw Error::File -text => $!; } catch Error::File with { my $err = shift; die "Cannot open file\n"; };
Obviously, you would put more around this. I even have a File.pm where I have an Open() function. That will handle more common things, like filetest operators and filename checks and throw useful error messages. Of course, my errors are specific to my needs. YMMV

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Log In?
Username:
Password:

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

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

    No recent polls found