line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Session::ErrorHandler; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# $Id$ |
4
|
|
|
|
|
|
|
|
5
|
30
|
|
|
30
|
|
241
|
use strict; |
|
30
|
|
|
|
|
392
|
|
|
30
|
|
|
|
|
2811
|
|
6
|
|
|
|
|
|
|
$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
|
|
|
|
|
|
|
sub set_error { |
41
|
52
|
|
|
52
|
1
|
115
|
my $class = shift; |
42
|
52
|
|
|
|
|
107
|
my $message = shift; |
43
|
52
|
|
66
|
|
|
416
|
$class = ref($class) || $class; |
44
|
30
|
|
|
30
|
|
183
|
no strict 'refs'; |
|
30
|
|
|
|
|
80
|
|
|
30
|
|
|
|
|
3641
|
|
45
|
52
|
|
100
|
|
|
314
|
${ "$class\::errstr" } = $message || ""; |
|
52
|
|
|
|
|
287
|
|
46
|
52
|
|
|
|
|
231
|
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
|
|
|
|
|
|
|
*error = \&errstr; |
58
|
|
|
|
|
|
|
sub errstr { |
59
|
72
|
|
|
72
|
1
|
1473
|
my $class = shift; |
60
|
72
|
|
66
|
|
|
651
|
$class = ref( $class ) || $class; |
61
|
|
|
|
|
|
|
|
62
|
30
|
|
|
30
|
|
173
|
no strict 'refs'; |
|
30
|
|
|
|
|
50
|
|
|
30
|
|
|
|
|
2763
|
|
63
|
72
|
|
100
|
|
|
128
|
return ${ "$class\::errstr" } || ''; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 LICENSING |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
For support and licensing information see L<CGI::Session|CGI::Session>. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|