| 1 | ###################################################################### | ||
| 2 | # Copyright (c)2010-2011, David L. Armstrong. | ||
| 3 | # | ||
| 4 | # P4::OO::_Error.pm | ||
| 5 | # | ||
| 6 | # See COPYRIGHT AND LICENSE section in pod text below for usage | ||
| 7 | # and distribution rights. | ||
| 8 | # | ||
| 9 | ###################################################################### | ||
| 10 | |||
| 11 | |||
| 12 | =head1 NAME | ||
| 13 | |||
| 14 | P4::OO::_Error - Exception hierarchy and handling decorator class | ||
| 15 | |||
| 16 | =head1 SYNOPSIS | ||
| 17 | |||
| 18 | use P4::OO::_Error; | ||
| 19 | |||
| 20 | =head1 DESCRIPTION | ||
| 21 | |||
| 22 | P4::OO::_Error is not intended to be used directly. It is only | ||
| 23 | inteded to be used by P4::OO subclasses that inherit this | ||
| 24 | functionality from P4::OO. | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | |||
| 29 | ###################################################################### | ||
| 30 | # Package Initialization | ||
| 31 | # | ||
| 32 | package P4::OO::_Error; | ||
| 33 | 28 | our $VERSION = '0.00_02'; | |
| 34 | |||
| 35 | 28 | ▶ | use Error::Simple; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 36 | 28 | ▶ | use base qw( Exporter Error::Simple ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 37 | |||
| 38 | # We'll re-export the try/catch/ignore/otherwise methods so | ||
| 39 | # none of the subclasses need to worry about them. | ||
| 40 | 28 | ▶ | use Error qw( :try ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 41 | 28 | ▶ | use vars qw( @EXPORT @EXPORT_OK %EXPORT_TAGS ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 42 | 28 | @EXPORT = qw( try otherwise with finally except ); | |
| 43 | 28 | @EXPORT_OK = @EXPORT; | |
| 44 | 28 | %EXPORT_TAGS = ( try => \@EXPORT_OK ); | |
| 45 | |||
| 46 | # This gets us the simpler Error::Simple style exceptions | ||
| 47 | 28 | ▶ | BEGIN { $Exception::Class::BASE_EXC_CLASS = 'P4::OO::_Error' } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 48 | |||
| 49 | # Set up our exception hierarchy | ||
| 50 | use Exception::Class | ||
| 51 | 28 | ▶ | ( 'E_Exception', |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 52 | 'E_Fatal' => { 'isa' => 'E_Exception', | ||
| 53 | 'description' => 'Generic Error - Fatal', | ||
| 54 | }, | ||
| 55 | 'E_Warning' => { 'isa' => 'E_Exception', | ||
| 56 | 'description' => 'Generic Error - Warning', | ||
| 57 | }, | ||
| 58 | 'E_BadSubClass' => { 'isa' => 'E_Fatal', | ||
| 59 | 'description' => 'Subclass does not comform to interface spec or cannot be found', | ||
| 60 | }, | ||
| 61 | 'E_P4Exception' => { 'isa' => 'E_Exception' | ||
| 62 | }, | ||
| 63 | 'E_P4Fatal' => { 'isa' => 'E_Fatal', | ||
| 64 | 'description' => 'Generic Internal Error.', | ||
| 65 | }, | ||
| 66 | 'E_P4Warning' => { 'isa' => 'E_Warning', | ||
| 67 | 'description' => 'Generic Internal Warning.', | ||
| 68 | }, | ||
| 69 | 28 | ); | |
| 70 | |||
| 71 | |||
| 72 | ###################################################################### | ||
| 73 | # Standard authorship and copyright for documentation | ||
| 74 | # | ||
| 75 | |||
| 76 | =head1 AUTHOR | ||
| 77 | |||
| 78 | David L. Armstrong <armstd@cpan.org> | ||
| 79 | |||
| 80 | =head1 COPYRIGHT AND LICENSE | ||
| 81 | |||
| 82 | P4::OO::_Error is Copyright (c)2010-2011, David L. Armstrong. | ||
| 83 | |||
| 84 | This module is free software; you can redistribute it and/or | ||
| 85 | modify it under the same terms as Perl itself, either Perl | ||
| 86 | version 5.8.8 or, at your option, any later version of Perl 5 | ||
| 87 | you may have available. | ||
| 88 | |||
| 89 | =head1 SUPPORT AND WARRANTY | ||
| 90 | |||
| 91 | This program is distributed in the hope that it will be | ||
| 92 | useful, but it is provided "as is" and without any expressed | ||
| 93 | or implied warranties. | ||
| 94 | |||
| 95 | =cut | ||
| 96 | |||
| 97 | 28 | 1; | |