NAME
Data::Object::Exception - Exception Object for Perl 5
VERSION
version 0.41
SYNOPSIS
use Data::Object::Exception;
my $exception = Data::Object::Exception->new;
$exception->throw('Something went wrong');
DESCRIPTION
Data::Object::Exception provides a functionality for creating, throwing, catching, and introspecting generic exception objects.
METHODS
catch
$exception->catch;
The catch method returns true if the argument is the same type of object as the invocant.
dump
$exception->dump;
The dump method returns a stringified version of the exception object.
file
$exception->file;
The file method returns the path to the file where the exception was thrown.
line
$exception->line;
The line method returns the line number in the file where the exception was thrown.
message
$exception->message;
The message method returns the message associated with the exception.
object
$exception->object;
The object method returns the object (or data) associated with the exception if available.
package
$exception->package;
The package method returns the package name where the exception was thrown.
subroutine
$exception->subroutine;
The subroutine method returns the fully-qualified subroutine name where the exception was thrown.
throw
$exception->throw;
The throw method terminates the program using the core die keyword passing the exception object as the only argument.
to_string
$exception->to_string;
The to_string method returns an informatve description of the exception thrown.
OPERATORS
This class overloads the following operators for your convenience.
string
"$exception"
# equivilent to
$exception->to_string
smartmatch
$value ~~ $exception
# equivilent to
$exception->data
SEE ALSO
AUTHOR
Al Newkirk <anewkirk@ana.io>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Al Newkirk.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.