Toby Ovod-Everett > Win32-ASP-DB > Win32::ASP::Error

Download:
Win32-ASP-DB-0.02.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

NAME ^

Win32::ASP::Error - an abstract parent class for implementing exceptions in Win32::ASP::DB

SYNOPSIS ^

  use Win32::ASP::Error;

  package Win32::ASP::Error::DBRecord;
  @Win32::ASP::Error::DBRecord::ISA = qw/Win32::ASP::Error/;

  package Win32::ASP::Error::DBRecord::no_permission;
  @Win32::ASP::Error::DBRecord::no_permission::ISA = qw/Win32::ASP::Error::DBRecord/;

  #Parameters:  action, identifier

  sub _as_html {
    my $self = shift;

    my $action = $self->action;
    my $identifier = $self->identifier;
    return <<ENDHTML;
  You are not allowed to $action $identifier.<P>
  ENDHTML
  }

  throw Win32::ASP::Error::DBRecord::no_permission (action => 'view', identifier => $identifier);

DESCRIPTION ^

Overview

Win32::ASP::Error is the abstract parent class used for implementing exceptions in the Win32::ASP::DB system. It inherits from Error::Unhandled, which allows exceptions to handle themselves if the calling program leaves the exception unhandled, and Class::SelfMethods, which allows instances to override methods and provides for method/attribute calling equivalence.

Utilization

In general, subclasses of Win32::ASP::Error implement the as_html method (properly implemented as _as_html so that instances can override it if necessary - see the Class::SelfMethods documentation for more explanation). This method should return properly formatted HTML that describes the condition that led to the exception and, if applicable, provides instruction to the user about how to rectify the problem.

The return value from the title method is used for the <TITLE> block in the returned web page.

syntax highlighting: