diff options
author | Tobi Oetiker <tobi@oetiker.ch> | 2007-11-14 18:33:19 +0100 |
---|---|---|
committer | Tobi Oetiker <tobi@oetiker.ch> | 2007-11-14 18:33:19 +0100 |
commit | ff7b9de82908baf1d5f9af71e35dad2369bfdc2f (patch) | |
tree | 1f9821bf2323786cbe68b4d3b0964ca449332766 /qooxdoo/source/perl/CGI/Session/ErrorHandler.pm | |
parent | d546419d19b89633f8ac3c461eb900f4c4f29b90 (diff) | |
download | smokeping-ff7b9de82908baf1d5f9af71e35dad2369bfdc2f.tar.gz smokeping-ff7b9de82908baf1d5f9af71e35dad2369bfdc2f.tar.xz |
initial qooxdoo drop for smokeping
Diffstat (limited to 'qooxdoo/source/perl/CGI/Session/ErrorHandler.pm')
-rw-r--r-- | qooxdoo/source/perl/CGI/Session/ErrorHandler.pm | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/qooxdoo/source/perl/CGI/Session/ErrorHandler.pm b/qooxdoo/source/perl/CGI/Session/ErrorHandler.pm new file mode 100644 index 0000000..8f42482 --- /dev/null +++ b/qooxdoo/source/perl/CGI/Session/ErrorHandler.pm @@ -0,0 +1,73 @@ +package CGI::Session::ErrorHandler; + +# $Id: ErrorHandler.pm 351 2006-11-24 14:16:50Z markstos $ + +use strict; +$CGI::Session::ErrorHandler::VERSION = "4.20"; + +=pod + +=head1 NAME + +CGI::Session::ErrorHandler - error handling routines for CGI::Session + +=head1 SYNOPSIS + + 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"); + } + } + +=head1 DESCRIPTION + +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 + +=head2 METHODS + +=over 4 + +=item set_error($message) + +Implicitly defines $pkg_name::errstr and sets its value to $message. Return value is B<always> undef. + +=cut + +sub set_error { + my $class = shift; + my $message = shift; + $class = ref($class) || $class; + no strict 'refs'; + ${ "$class\::errstr" } = sprintf($message || "", @_); + return; +} + +=item errstr() + +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. + +=back + +=cut + +*error = \&errstr; +sub errstr { + my $class = shift; + $class = ref( $class ) || $class; + + no strict 'refs'; + return ${ "$class\::errstr" } || ''; +} + +=head1 LICENSING + +For support and licensing information see L<CGI::Session|CGI::Session>. + +=cut + +1; + |