Session/ErrorHandler.pm

filter: Statementstmt 100% 21 / 21 Branchbran n/a Conditioncond 40.0% 4 / 10 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 72.7% 32 / 44 SCAR 16.5
CC
5
Cov
81%
errstr
3.1
set_error
3.1
BEGIN
1.0
CRAP 5.2
« Session/ID/static.pm ↑ Summary Session/Serialize/freezethaw.pm »
1 package CGI::Session::ErrorHandler;
2  
3 # $Id: ErrorHandler.pm 216 2005-09-01 10:52:26Z sherzodr $
4  
5 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 16 $CGI::Session::ErrorHandler::VERSION = "4.01";
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 sub set_error {
41 1 ▶ my $class = shift;
Subroutine set_error: called CC=3 SCAR=11.3
Pod documented
42 1 ▶ $class = ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
010
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
43 16 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
44 1 ▶ ${ "$class\::errstr" } = $_[0] || "";
Condition50%1/2
$_[0] || ''
l!l
10
MC/DC0%0/1
$_[0] || ''
$_[0]
Truth table50%1/2
A
A= $_[0]
Aresult
11
00
45 1 return;
46 }
47  
48 =item errstr()
49  
50 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.
51  
52 =back
53  
54 =cut
55  
56 16 *error = \&errstr;
57 sub errstr {
58 2 ▶ my $class = shift;
Subroutine errstr: called CC=3 SCAR=11.4
Pod documented
59 2 ▶ $class = ref( $class ) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
60  
61 16 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
62 2 ▶ return ${ "$class\::errstr" } || '';
Condition50%1/2
${"${class}::errstr";} || ''
l!l
20
MC/DC0%0/1
${"${class}::errstr";} || ''
${"${class}::errstr";}
Truth table50%1/2
A
A= ${"${class}::errstr";}
Aresult
11
00
63 }
64  
65 =head1 LICENSING
66  
67 For support and licensing information see L<CGI::Session|CGI::Session>.
68  
69 =cut
70  
71 16 1;
72  
« Session/ID/static.pm ↑ Summary Session/Serialize/freezethaw.pm »