NAME

TryCatch::Error - A simple error base class.

VERSION

Version 0.01

SYNOPSIS

This module provides a building block to writing your own error objects, to use with TryCatch (or some similar module).

It enables you to write things like this, straight away:

use TryCatch::Error;
use TryCatch;

try {
    # ...
    # something that can go horribly wrong
    if ( $error_condition ) {
        die TryCatch::Error->new( value => $foo, message => $bar );
    }
}
catch ( TryCatch::Error $e ) {
    print STDERR 'Ooops: ', $e->get_message, ' with ', $e->get_value;
}

TryCatch::Error can be sub-classed to create your own errors (possibly containing more detail, see t/03-subclassing.t for an example).

FUNCTIONS

new

Create a new error object:

my $e = TryCatch::Error->new( value => $foo, message => bar );

ACCESSORS

get_*

set_*

The default TryCatch::Error has 2 attributes, value and message, which are an integer and a string.

AUTHOR

Pedro Figueiredo, <me at pedrofigueiredo.org>

BUGS

Please report any bugs or feature requests to bug-trycatch-error at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=TryCatch-Error. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc TryCatch::Error

You can also look for information at:

ACKNOWLEDGEMENTS

  • Ash Berlin, the author of TryCatch

  • The Moose crew

COPYRIGHT & LICENSE

Copyright 2009 Pedro Figueiredo, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.