| Filename | /usr/share/perl5/CGI/Session/ErrorHandler.pm |
| Statements | Executed 17 statements in 209µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 12µs | 26µs | CGI::Session::ErrorHandler::BEGIN@5 |
| 1 | 1 | 1 | 10µs | 18µs | CGI::Session::ErrorHandler::BEGIN@44 |
| 1 | 1 | 1 | 6µs | 6µs | CGI::Session::ErrorHandler::errstr |
| 1 | 1 | 1 | 6µs | 13µs | CGI::Session::ErrorHandler::BEGIN@62 |
| 1 | 1 | 1 | 5µs | 5µs | CGI::Session::ErrorHandler::set_error |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package CGI::Session::ErrorHandler; | ||||
| 2 | |||||
| 3 | # $Id$ | ||||
| 4 | |||||
| 5 | 2 | 73µs | 2 | 39µs | # spent 26µs (12+14) within CGI::Session::ErrorHandler::BEGIN@5 which was called:
# once (12µs+14µs) by CGI::Session::BEGIN@4 at line 5 # spent 26µs making 1 call to CGI::Session::ErrorHandler::BEGIN@5
# spent 14µs making 1 call to strict::import |
| 6 | 1 | 300ns | $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 | # spent 5µs within CGI::Session::ErrorHandler::set_error which was called:
# once (5µs+0s) by CGI::Session::new at line 59 of CGI/Session.pm | ||||
| 41 | 1 | 400ns | my $class = shift; | ||
| 42 | 1 | 300ns | my $message = shift; | ||
| 43 | 1 | 400ns | $class = ref($class) || $class; | ||
| 44 | 2 | 70µs | 2 | 25µs | # spent 18µs (10+8) within CGI::Session::ErrorHandler::BEGIN@44 which was called:
# once (10µs+8µs) by CGI::Session::BEGIN@4 at line 44 # spent 18µs making 1 call to CGI::Session::ErrorHandler::BEGIN@44
# spent 8µs making 1 call to strict::unimport |
| 45 | 1 | 3µs | ${ "$class\::errstr" } = $message || ""; | ||
| 46 | 1 | 3µs | 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 | 1 | 1µs | *error = \&errstr; | ||
| 58 | # spent 6µs within CGI::Session::ErrorHandler::errstr which was called:
# once (6µs+0s) by CGI::Session::load at line 702 of CGI/Session.pm | ||||
| 59 | 1 | 900ns | my $class = shift; | ||
| 60 | 1 | 600ns | $class = ref( $class ) || $class; | ||
| 61 | |||||
| 62 | 2 | 43µs | 2 | 20µs | # spent 13µs (6+7) within CGI::Session::ErrorHandler::BEGIN@62 which was called:
# once (6µs+7µs) by CGI::Session::BEGIN@4 at line 62 # spent 13µs making 1 call to CGI::Session::ErrorHandler::BEGIN@62
# spent 7µs making 1 call to strict::unimport |
| 63 | 1 | 9µs | 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 | 3µs | 1; | ||
| 73 |