| CGI-Session documentation | Contained in the CGI-Session distribution. |
CGI::Session::ErrorHandler - error handling routines for CGI::Session
require CGI::Session::ErrorHandler;
@ISA = qw( CGI::Session::ErrorHandler );
sub some_method {
my $self = shift;
unless ( $some_condition ) {
return $self->set_error("some_method(): \$some_condition isn't met");
}
}
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
Implicitly defines $pkg_name::errstr and sets its value to $message. Return value is always undef.
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.
For support and licensing information see CGI::Session.
| CGI-Session documentation | Contained in the CGI-Session distribution. |
package CGI::Session::ErrorHandler; # $Id$ use strict; $CGI::Session::ErrorHandler::VERSION = '4.43';
sub set_error { my $class = shift; my $message = shift; $class = ref($class) || $class; no strict 'refs'; ${ "$class\::errstr" } = $message || ""; return; }
*error = \&errstr; sub errstr { my $class = shift; $class = ref( $class ) || $class; no strict 'refs'; return ${ "$class\::errstr" } || ''; }
1;