diff options
Diffstat (limited to 'README')
-rw-r--r-- | README | 90 |
1 files changed, 90 insertions, 0 deletions
@@ -0,0 +1,90 @@ +NAME + Error - Error/exception handling in an OO-ish way + +DESCRIPTION + The Error package provides two interfaces. Firstly Error provides + a procedural interface to exception handling. Secondly Error is a + base class for errors/exceptions that can either be thrown, for + subsequent catch, or can simply be recorded. + + Errors in the class Error should not be thrown directly, but the + user should throw errors from a sub-class of Error + +SYNOPSIS + + use Error qw(:try); + + throw Error::Simple( "A simple error"); + + sub xyz { + ... + record Error::Simple("A simple error") + and return; + } + + unlink($file) or throw Error::Simple("$file: $!",$!); + + try { + do_some_stuff(); + die "error!" if $condition; + throw Error::Simple -text => "Oops!" if $other_condition; + } + catch Error::IO with { + my $E = shift; + print STDERR "File ", $E->{'-file'}, " had a problem\n"; + } + except { + my $E = shift; + my $general_handler=sub {send_message $E->{-description}}; + return { + UserException1 => $general_handler, + UserException2 => $general_handler + }; + } + otherwise { + print STDERR "Well I don't know what to say\n"; + } + finally { + close_the_garage_door_already(); # Should be reliable + }; # Don't forget the trailing ; or you might be surprised + +AUTHORS + + Graham Barr <gbarr@pobox.com> + + The code that inspired me to write this was originally written by + Peter Seibel <peter@weblogic.com> and adapted by Jesse Glick + <jglick@sig.bsh.com>. + +MAINTAINER + + Arun Kumar U <u_arunkumar@yahoo.com> + + ===================== + +HOW TO INSTALL IT ? + +To install this module, cd to the directory that contains this README +file and type the following: + + perl Makefile.PL + make test + make install + +To install this module into a specific directory, do: +perl Makefile.PL PREFIX=/name/of/the/directory +...the rest is the same... + +Please also read the perlmodinstall man page, if available. + +Share and Enjoy !! + +Arun Kumar U +<u_arunkumar@yahoo.com> + +------------------------------------------------------------------------------- + Only wimps use tape backup: *real* men just upload their important + stuff on ftp, and let the rest of the world mirror it. + - Linus Torvalds +------------------------------------------------------------------------------- + |