File Coverage

blib/lib/HTTP/Exception/Base.pm
Criterion Covered Total %
statement 15 15 100.0
branch 4 4 100.0
condition 3 6 50.0
subroutine 6 6 100.0
pod 3 4 75.0
total 31 35 88.5


line stmt bran cond sub pod time code
1             package HTTP::Exception::Base;
2             $HTTP::Exception::Base::VERSION = '0.04006';
3 27     27   148 use strict;
  27         62  
  27         974  
4 27     27   144 use base 'Exception::Class::Base';
  27         48  
  27         30717  
5              
6             ################################################################################
7             # roll our own new, because of message
8             # error, message and status_message are synonyms
9             sub new {
10 651     651 1 463882 my $proto = shift;
11 651   33     4275 my $class = ref $proto || $proto;
12 651         1546 my %params = @_;
13 651 100       2281 $params{status_message} = delete $params{message} if (exists $params{message});
14              
15 651         4143 $class->SUPER::new(%params);
16             }
17              
18             ################################################################################
19             # used by Exception::Class for as_string
20 492     492 1 304255 sub full_message { shift->status_message }
21              
22             ################################################################################
23             # TODO default-value/required fields, maybe moose? but maybe a moose is too heavy
24             # but on the other hand, handmade accessors suck
25             sub status_message {
26 1063 100   1063 0 515992 $_[0]->{status_message} = $_[1] if (@_ > 1);
27 1063   66     11453 return $_[0]->{status_message} ||= $_[0]->_status_message;
28             }
29             *message = \&status_message;
30             *error = \&status_message;
31              
32             ################################################################################
33             # though Exception::Class::Base does have fields, the Fields-Accessor returns ()
34             # so no shift->SUPER::Fields is required
35 1116     1116 1 741429 sub Fields { qw(status_message) }
36              
37             1;
38              
39              
40             =head1 NAME
41              
42             HTTP::Exception::Base - Base Class for exception classes created by HTTP::Exception
43              
44             =head1 VERSION
45              
46             version 0.04006
47              
48             =head1 DESCRIPTION
49              
50             This Class is a Base class for exception classes created by HTTP::Exception.
51             It inherits from L. Please refer to the Documentation
52             of L for methods and accessors a HTTP::Exception inherits.
53              
54             You won't use this Class directly, so refer to L
55             and L. The methods and attributes this Class provides
56             over Exception::Class::Base are described there.
57              
58             =head1 AUTHOR
59              
60             Thomas Mueller, C<< >>
61              
62             =head1 BUGS
63              
64             Please report any bugs or feature requests to
65             C, or through the web interface at
66             L.
67             I will be notified, and then you'll automatically be notified of progress on
68             your bug as I make changes.
69              
70             =head1 SUPPORT
71              
72             You can find documentation for this module with the perldoc command.
73              
74             perldoc HTTP::Exception::Base
75              
76             You can also look for information at:
77              
78             =over 4
79              
80             =item * RT: CPAN's request tracker
81              
82             L
83              
84             =item * AnnoCPAN: Annotated CPAN documentation
85              
86             L
87              
88             =item * CPAN Ratings
89              
90             L
91              
92             =item * Search CPAN
93              
94             L
95              
96             =back
97              
98             =head1 LICENSE AND COPYRIGHT
99              
100             Copyright 2010 Thomas Mueller.
101              
102             This program is free software; you can redistribute it and/or modify it
103             under the terms of either: the GNU General Public License as published
104             by the Free Software Foundation; or the Artistic License.
105              
106             See http://dev.perl.org/licenses/ for more information.
107              
108              
109             =cut