Apache-ErrorControl

 view release on metacpan or  search on metacpan

ErrorControl.pm  view on Meta::CPAN

      'Type'        => 'multipart/mixed',
      'X-Mailer'    => 'Apache::ErrorControl'
    );

    my $body = 'Time: '. $formatted_date. "\n".
                'Requested URL: '. $request_url. "\n".
                'Requested By: '. $requestor. "\n\n".
                "--------------------\n".
                "Apache::ErrorControl\n\n";

    $mobj->attach(
      Data     => $body,
      Type     => 'text/plain'
    );

    # Construct Included Debug
    my %content;
    my ($headers_in, $headers_out, $err_headers_out, $subprocess_env);
    if ($r->prev()) {
      %content         =  $r->prev()->content();
      $headers_in      =  $r->prev()->headers_in();

ErrorControl.pm  view on Meta::CPAN

      err_headers_out =>  $err_headers_out,
      notes           =>  $notes,
      subprocess_env  =>  $subprocess_env,
      post_data       =>  \%content,
      env             =>  \%ENV
    );

    foreach my $file (keys %files) {
      my $string = $self->apache_table_to_string($files{$file});
      if ($string) {
        $mobj->attach(
          Data     =>  $string,
          Filename =>  $file. '.txt',
          Type     =>  'text/plain',
          Encoding =>  'base64'
        );
      }
    }

    foreach my $email_address (@email) {
      $mobj->head()->replace('To', $email_address);

ErrorControl.pm  view on Meta::CPAN

  ErrorDocument 401 /error/401

I dont see why you would want to statically configure an I<error code>, unless
of course you run into problems for some reason and are forced to.

=head1 ERROR EMAILS

This module has the ability to send an email on an error. you can define
what error code to email on and what email addresses to send emails to, please
see the B<OPTIONS> section on how to do this. the error email contains various
attached files and these are present in the email depending on weather or not
their data could be retrieved. the attached files are detailed below.

=over 4

=item *

B<headers_in.txt> - the inwards headers, a snapshot of the L<Apache::Table>
retrieved from C<$r-E<gt>prev()-E<gt>headers_in()>.

=item *

ErrorControl.pm  view on Meta::CPAN

I<error codes>: 204, 304, 400, 408, 411, 413, 414, 500, 501, 503 which doesnt
worry me since 500 is one of the mentioned codes - but you may need the
I<POST> data for a different I<error code>. I<GET> data of course is tacked
onto the end of the request_uri.  the I<POST> data will also not appear
unless the I<Content-Type> is C<application/x-www-form-urlencoded>.

=back

=head2 EXAMPLE EMAIL

Below is an example email (obviously missing the file attachments).

  Subject: Error 500 on www.abc.com

  Time: 2004-05-05 14:27:22
  Requested URL: http://www.abc.com/testing/testing123.cgi
  Requested By: dj (dj.abc.com (10.0.0.10))

  --------------------
  Apache::ErrorControl



( run in 0.649 second using v1.01-cache-2.11-cpan-e1769b4cff6 )