Apache2::ASP::ErrorHandler - Default fatal error handler


Apache2-ASP documentation  | view source Contained in the Apache2-ASP distribution.

Index


NAME

Top

Apache2::ASP::ErrorHandler - Default fatal error handler

SYNOPSIS

Top

In your apache2-asp-config.xml:

  <?xml version="1.0" ?>
  <config>
    ...
    <errors>
      <error_handler>Apache2::ASP::ErrorHandler</error_handler>
      <mail_errors_to>you@your-site.com</mail_errors_to>
      <mail_errors_from>root@localhost</mail_errors_from>
      <smtp_server>localhost</smtp_server>
    </errors>
    ...
  </config>

DESCRIPTION

Top

This class provides a default error handler which does the following:

1) Makes a simple HTML page and prints it to the browser, telling the user that an error has just occurred.

2) Sends that same HTML to the email address specified in the config, using the SMTP server also specified in the config. The email subject will look something like:

  Apache2::ASP: Error in your-site.com/index.asp

SUBCLASSING

Top

To subclass Apache2::ASP::ErrorHandler you must do the following:

  package My::ErrorHandler;

  use strict;
  use warnings 'all';
  use base 'Apache2::ASP::ErrorHandler';
  use vars __PACKAGE__->VARS;

  sub run {
    my ($s, $context) = @_;

    my $error = $Stash->{error};

    # $error looks like this:
    $VAR1 = {
      title       => 'Cannot call execute with a reference',
      file        => '/tmp/PAGE_CACHE/mysite/index_asp.pm',
      line        => 45,
      stacktrace  => # Output from Carp::confess,
    };

    # Do something here about the error.
  }

  1;# return true:

BUGS

Top

It's possible that some bugs have found their way into this release.

Use RT http://rt.cpan.org/NoAuth/Bugs.html?Dist=Apache2-ASP to submit bug reports.

HOMEPAGE

Top

Please visit the Apache2::ASP homepage at http://www.devstack.com/ to see examples of Apache2::ASP in action.

AUTHOR

Top

John Drago <jdrago_999@yahoo.com>

COPYRIGHT

Top

LICENSE

Top

This software is Free software and is licensed under the same terms as perl itself.


Apache2-ASP documentation  | view source Contained in the Apache2-ASP distribution.