Exception/Base.pm

filter: Statementstmt 100% 22 / 22 Branchbran 100% 4 / 4 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 7 / 7 Podpod 75.0% 3 / 4 totaltotal 82.9% 39 / 47 CC 5 SCAR 7.5
CC
5
Cov
91%
new
3.1
status_message
3.0
BEGIN
1.0
CRAP 2.1
« Exception/Loader.pm ↑ Summary Exception.pm »
1 package HTTP::Exception::Base;
2 27 $HTTP::Exception::Base::VERSION = '0.04007';
3 27 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 27 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 27 ▶use base 'Exception::Class::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 ################################################################################
8 # roll our own new, because of message
9 # error, message and status_message are synonyms
10 743 ▶sub new {
Subroutine new: called CC=3 SCAR=11.2
Pod documented
11 743 my $proto = shift;
12 743 ▶ my $class = ref $proto || $proto;
Condition33%1/3
ref $proto || $proto
l!l&&r!l&&!r
07430
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
13 743 my %params = @_;
14 743 ▶ $params{status_message} = delete $params{message} if (exists $params{message});
Branch: 1 branch
BranchTrueFalseTotal
if exists $params{"message"} 6 737 743
15  
16 743 $class->SUPER::new(%params);
17 }
18  
19 ################################################################################
20 # used by Exception::Class for as_string
21 562 ▶sub full_message { shift->status_message }
Subroutine full_message: called CC=1 SCAR=0.0
Pod documented
22  
23 ################################################################################
24 # TODO default-value/required fields, maybe moose? but maybe a moose is too heavy
25 # but on the other hand, handmade accessors suck
26 1213 ▶sub status_message {
Subroutine status_message: called CC=3 SCAR=11.1
Pod undocumented
27 1213 ▶ $_[0]->{status_message} = $_[1] if (@_ > 1);
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 1 2 1211 1213
28 1213 ▶ return $_[0]->{status_message} ||= $_[0]->_status_message;
Condition66%2/3
$_[0]{"status_message"} ||= $_[0]->_status_message
l!l&&r!l&&!r
6645490
MC/DC0%0/2
$_[0]{"status_message"} ||= $_[0]->_status_message
$_[0]{"status_message"} $_[0]->_status_message
Truth table66%2/3
A ||= B
A= $_[0]{"status_message"}B= $_[0]->_status_message
ABresult
1X1
011
000
29 }
30 27 *message = \&status_message;
31 27 *error = \&status_message;
32  
33 ################################################################################
34 # though Exception::Class::Base does have fields, the Fields-Accessor returns ()
35 # so no shift->SUPER::Fields is required
36 1284 ▶sub Fields { qw(status_message) }
Subroutine Fields: called CC=1 SCAR=0.0
Pod documented
37  
38 27 1;
39  
40  
41 =head1 NAME
42  
43 HTTP::Exception::Base - Base Class for exception classes created by HTTP::Exception
44  
45 =head1 VERSION
46  
47 version 0.04007
48  
49 =head1 DESCRIPTION
50  
51 This Class is a Base class for exception classes created by HTTP::Exception.
52 It inherits from L<Exception::Class::Base>. Please refer to the Documentation
53 of L<Exception::Class::Base> for methods and accessors a HTTP::Exception inherits.
54  
55 You won't use this Class directly, so refer to L<HTTP::Exception/"ACCESSORS">
56 and L<HTTP::Exception/"FIELDS">. The methods and attributes this Class provides
57 over Exception::Class::Base are described there.
58  
59 =head1 AUTHOR
60  
61 Thomas Mueller, C<< <tmueller at cpan.org> >>
62  
63 =head1 BUGS
64  
65 Please report any bugs or feature requests to
66 C<bug-http-exception at rt.cpan.org>, or through the web interface at
67 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTTP-Exception>.
68 I will be notified, and then you'll automatically be notified of progress on
69 your bug as I make changes.
70  
71 =head1 SUPPORT
72  
73 You can find documentation for this module with the perldoc command.
74  
75 perldoc HTTP::Exception::Base
76  
77 You can also look for information at:
78  
79 =over 4
80  
81 =item * RT: CPAN's request tracker
82  
83 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTTP-Exception>
84  
85 =item * AnnoCPAN: Annotated CPAN documentation
86  
87 L<http://annocpan.org/dist/HTTP-Exception>
88  
89 =item * CPAN Ratings
90  
91 L<http://cpanratings.perl.org/d/HTTP-Exception>
92  
93 =item * Search CPAN
94  
95 L<https://metacpan.org/release/HTTP-Exception>
96  
97 =back
98  
99 =head1 LICENSE AND COPYRIGHT
100  
101 Copyright 2010 Thomas Mueller.
102  
103 This program is free software; you can redistribute it and/or modify it
104 under the terms of either: the GNU General Public License as published
105 by the Free Software Foundation; or the Artistic License.
106  
107 See http://dev.perl.org/licenses/ for more information.
108  
109  
110 =cut
« Exception/Loader.pm ↑ Summary Exception.pm »