Session/ErrorHandler.pm

filter: Statementstmt 100% 22 / 22 Branchbran n/a Conditioncond 80.0% 8 / 10 MC/DCmcdc 33.3% 2 / 6 Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 86.6% 39 / 45 CC 5 SCAR 8.5
CC
5
Cov
94%
errstr
3.0
set_error
3.0
BEGIN
1.0
CRAP 2.3
« Session/Test/Default.pm ↑ Summary Session/Serialize/freezethaw.pm »
1 package CGI::Session::ErrorHandler;
2  
3 # $Id$
4  
5 29 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 29 $CGI::Session::ErrorHandler::VERSION = '4.43';
7  
8 =pod
9  
10 =head1 NAME
11  
12 CGI::Session::ErrorHandler - error handling routines for CGI::Session
13  
14 =head1 SYNOPSIS
15  
16 require CGI::Session::ErrorHandler;
17 @ISA = qw( CGI::Session::ErrorHandler );
18  
19 sub some_method {
20 my $self = shift;
21 unless ( $some_condition ) {
22 return $self->set_error("some_method(): \$some_condition isn't met");
23 }
24 }
25  
26 =head1 DESCRIPTION
27  
28 CGI::Session::ErrorHandler provides set_error() and errstr() methods for setting and accessing error messages from within CGI::Session's components. This method should be used by driver developers for providing CGI::Session-standard error handling routines for their code
29  
30 =head2 METHODS
31  
32 =over 4
33  
34 =item set_error($message)
35  
36 Implicitly defines $pkg_name::errstr and sets its value to $message. Return value is B<always> undef.
37  
38 =cut
39  
40 47 ▶sub set_error {
Subroutine set_error: called CC=3 SCAR=11.0
Pod documented
41 47 my $class = shift;
42 47 my $message = shift;
43 47 ▶ $class = ref($class) || $class;
Condition66%2/3
ref $class || $class
l!l&&r!l&&!r
1460
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table66%2/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
44 29 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
45 47 ▶ ${ "$class\::errstr" } = $message || "";
Condition100%2/2
$message || ''
l!l
245
MC/DC100%1/1
$message || ''
$message
Truth table100%2/2
A
A= $message
Aresult
11
00
46 47 return;
47 }
48  
49 =item errstr()
50  
51 Returns whatever value was set by the most recent call to set_error(). If no message as has been set yet, the empty string is returned so the message can still concatenate without a warning.
52  
53 =back
54  
55 =cut
56  
57 29 *error = \&errstr;
58 68 ▶sub errstr {
Subroutine errstr: called CC=3 SCAR=11.0
Pod documented
59 68 my $class = shift;
60 68 ▶ $class = ref( $class ) || $class;
Condition66%2/3
ref $class || $class
l!l&&r!l&&!r
1670
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table66%2/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
61  
62 29 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
63 68 ▶ return ${ "$class\::errstr" } || '';
Condition100%2/2
${"${class}::errstr";} || ''
l!l
365
MC/DC100%1/1
${"${class}::errstr";} || ''
${"${class}::errstr";}
Truth table100%2/2
A
A= ${"${class}::errstr";}
Aresult
11
00
64 }
65  
66 =head1 LICENSING
67  
68 For support and licensing information see L<CGI::Session|CGI::Session>.
69  
70 =cut
71  
72 29 1;
73  
« Session/Test/Default.pm ↑ Summary Session/Serialize/freezethaw.pm »