OpenFrame::WebApp::Error - base class for WebApp Errors.


OpenFrame-WebApp documentation  | view source Contained in the OpenFrame-WebApp distribution.

Index


NAME

Top

OpenFrame::WebApp::Error - base class for WebApp Errors.

SYNOPSIS

Top

  # meant to be sub-classed:
  use OpenFrame::WebApp::Error::SomeClass;

  # should export some error flags to your namespace

  use Error qw( :try );
  try {
      throw OpenFrame::WebApp::Error::SomeClass( flag => eSomeError );
  } catch OpenFrame::WebApp::Error::SomeClass with {
      my $e = shift;
      do { ... } if ($e->flag == eSomeError);
  }

DESCRIPTION

Top

This is the base class for Error exceptions in OpenFrame-WebApp. It introduces an error flag to the Error module in an attempt to make localization easier.

Descriptive error flags should be exported from each subclass:

  use base qw( Exporter OpenFrame::WebApp::Error );
  our @EXPORT = qw( eSomethingBad );
  use constant eSomethingBad => 'something.bad';

The value of these constants can then be used as localization keys with the likes of Locale::Gettext or Locale::Maketext.

CONSTRUCTOR

Top

new recognizes '-flag' as a synonym for '-text'. The '-' is optional:

  throw Some::Error( flag => eSomethingBad );

METHODS

Top

flag

set/get the error flag.

AUTHOR

Top

Steve Purkis <spurkis@epn.nu>

COPYRIGHT

Top

SEE ALSO

Top

Error, OpenFrame::WebApp


OpenFrame-WebApp documentation  | view source Contained in the OpenFrame-WebApp distribution.