Error-Hierarchy
view release on metacpan or search on metacpan
lib/Error/Hierarchy.pm view on Meta::CPAN
get the actual depth. In this class the C<error_depth()> defaults to 1 so the
exception is at least reported from the place where it was actually thrown - a
value of 0 would mean that the exception is reported as having occurred
L<Error::Hierarchy> itself, which is probably not what you want.
If you override this value in a subclass, it's probably a good idea to add the
subclass' desired depth to the superclass's depth to accumulate it. For
example:
package MyException;
use base 'Error::Hierarchy';
sub error_depth {
my $self = shift;
1 + $self->SUPER::error_depth();
}
=head2 comparable
Support for L<Data::Comparable>.
=head2 init
Initializes a newly constructed exception object.
=head2 get_properties
Actual exception classes will subclass this class and define properties.
Exception classes themselves can be subclassed. So this method returns the
inherited list of all the exception class' properties.
=head2 properties_as_hash
Constructs a hash whose keys are the exception's properties - see
C<get_properties()> - and whose values are the values of each property in the
exception object. The properties C<package>, C<filename> and C<line> are
omitted.
In list context, the hash is returned as is. In scalar context, a reference to
the hash is returned.
=head2 stringify
Defines how the exception should look if the object is stringified. This class
inherits from L<Error::Hierarchy::Base>, which overloads C<""> to call
C<stringify()>.
This class stringifies an itself by taking the C<message()> attribute and
passing it to C<sprintf()>, along with the exception's properties.
=head2 transmute($exception, %args)
Transmutes an existing exception. It leaves the stack trace, filename, line
etc. as it is and just blesses it into the class on which C<transmute()> was
called, adding the given additional arguments. This is used when catching a
generic exception and turning it into a more specific one.
=head1 INSTALLATION
See perlmodinstall for information and options on installing Perl modules.
=head1 BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests through the web interface at
L<http://rt.cpan.org/Public/Dist/Display.html?Name=Error-Hierarchy>.
=head1 AVAILABILITY
The latest version of this module is available from the Comprehensive Perl
Archive Network (CPAN). Visit L<http://www.perl.com/CPAN/> to find a CPAN
site near you, or see L<http://search.cpan.org/dist/Error-Hierarchy/>.
The development version lives at L<http://github.com/hanekomu/Error-Hierarchy>
and may be cloned from L<git://github.com/hanekomu/Error-Hierarchy>.
Instead of sending patches, please fork this project using the standard
git and github infrastructure.
=head1 AUTHOR
Marcel Gruenauer <marcel@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2004 by Marcel Gruenauer.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
( run in 4.203 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )