perl-Error.pm / module /

Filename Size Date modified Message
..
examples
inc
lib
scripts
t
561 B
9.2 KB
778 B
302 B
2.4 KB
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
-------------------------------------------------------------------------------

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.