CGI::MxScreen::Error - Error return codes for action callbacks


CGI-MxScreen documentation Contained in the CGI-MxScreen distribution.

Index


Code Index:

NAME

Top

CGI::MxScreen::Error - Error return codes for action callbacks

SYNOPSIS

Top

 use CGI::MxScreen::Error;

 sub action {                # action callback
     ...
	 return CGI_MX_ABORT;    # for instance
 }

DESCRIPTION

Top

This module exports the return codes to use in action callbacks:

CGI_MX_OK

Signals everything went fine.

CGI_MX_ABORT

An error was detected, and the action callback chain should be immediately exited. No further callbacks will be invoked.

CGI_MX_ERROR

An error was detected, but further action callbacks may still execute. The error condition is remembered and will be raised at the end of the callback chain.

AUTHORS

Top

The original authors are Raphael Manfredi <Raphael_Manfredi@pobox.com> and Christophe Dehaudt <Christophe.Dehaudt@teamlog.fr>.

Send bug reports, suggestions, problems or questions to Jason Purdy <Jason@Purdy.INFO>

SEE ALSO

Top

CGI::MxScreen::Form::Button(3).


CGI-MxScreen documentation Contained in the CGI-MxScreen distribution.

# -*- Mode: perl -*-
#
# $Id: Error.pm,v 0.1 2001/04/22 17:57:03 ram Exp $
#
#  Copyright (c) 1998-2001, Raphael Manfredi
#  Copyright (c) 2000-2001, Christophe Dehaudt
#  
#  You may redistribute only under the terms of the Artistic License,
#  as specified in the README file that comes with the distribution.
#
# HISTORY
# $Log: Error.pm,v $
# Revision 0.1  2001/04/22 17:57:03  ram
# Baseline for first Alpha release.
#
# $EndLog$
#

use strict;

package CGI::MxScreen::Error;

require Exporter;

use vars qw(@ISA @EXPORT @EXPORT_OK);
@ISA = qw(Exporter);

my @ERRORS = qw(
	CGI_MX_OK
	CGI_MX_ABORT
	CGI_MX_ERROR
);

@EXPORT    = @ERRORS;
@EXPORT_OK = qw(is_mx_errcode);

#
# Errors have weird values, on purpose, so that constants are used.
#

use constant CGI_MX_OK		=> 3;		# OK
use constant CGI_MX_ERROR	=> 8;		# Error detected, can run other cbacks
use constant CGI_MX_ABORT	=> 17;		# Abort processing, no more cback

my %ERRORS;
{
	no strict 'refs';
	%ERRORS = map { &{$_}() => undef } @ERRORS;
}

#
# is_mx_errcode
#
# Check whether value is a valid CGI_MX_* error code.
#
sub is_mx_errcode {
	my ($err) = @_;
	return exists $ERRORS{$err} ? 1 : 0;
}

1;