File Coverage

blib/lib/P4/OO/_Error.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 22 22 100.0


line stmt bran cond sub pod time code
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             our $VERSION = '0.00_02';
34              
35 28     28   104066 use Error::Simple;
  28         262826  
  28         362  
36 28     28   1591 use base qw( Exporter Error::Simple );
  28         70  
  28         3744  
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     28   192 use Error qw( :try );
  28         67  
  28         134  
41 28     28   5444 use vars qw( @EXPORT @EXPORT_OK %EXPORT_TAGS );
  28         140  
  28         2991  
42             @EXPORT = qw( try otherwise with finally except );
43             @EXPORT_OK = @EXPORT;
44             %EXPORT_TAGS = ( try => \@EXPORT_OK );
45              
46             # This gets us the simpler Error::Simple style exceptions
47 28     28   2024 BEGIN { $Exception::Class::BASE_EXC_CLASS = 'P4::OO::_Error' }
48              
49             # Set up our exception hierarchy
50             use Exception::Class
51 28         469 ( 'E_Exception',
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     28   34581 );
  28         323268  
70              
71              
72             ######################################################################
73             # Standard authorship and copyright for documentation
74             #
75              
76             =head1 AUTHOR
77              
78             David L. Armstrong
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             1;