CGI::Carp::Fatals - fatalsToBrowser on steroids


CGI-Carp-Fatals documentation Contained in the CGI-Carp-Fatals distribution.

Index


Code Index:

NAME

Top

CGI::Carp::Fatals - fatalsToBrowser on steroids

SYNOPSIS

Top

	use CGI::Carp::Fatals;

	use CGI::Carp::Fatals qw(fatalsRemix);
	fatalsRemix();

	use CGI::Carp::Fatals qw(fatalsRemix);
	fatalsRemix('INFO_GENERAL');

	use CGI::Carp::Fatals qw(set_message);
	set_message("It's not a bug, it's a feature!");

DESCRIPTION

Top

This module extends CGI::Carp by adding perlinfo information (from HTML::Perlinfo) to fatal errors handled by CGI::Carp's fatalsToBrowser.

USAGE/FUNCTIONS

Top

Using CGI::Carp::Fatals enables fatalsToBrowser from CGI::Carp. This is a feature.

If you wish to enhance ("juice") those error messages, you can import a function called 'fatalsRemix'. It will append perlinfo data to the error reports. This function accepts the same options as the perlinfo function from HTML::Perlinfo.

By default, fatalsRemix uses the INFO_VARIABLES option which shows you all predefined variables from EGPCS (Environment, GET, POST, Cookie, Server). Please see the HTML::Perlinfo docs for further options and details.

	use CGI::Carp::Fatals qw(fatalsRemix);
        fatalsRemix(); # defaults to INFO_VARIABLES
	fatalsRemix('INFO_GENERAL'); # now includes INFO_GENERAL. There are many other options.

Changing the message further

If changing the option to fatalsRemix doesn't satisfy you, you can use the set_message routine that CGI::Carp::Fatals exports from CGI::Carp. Please refer to the documentation of CGI::Carp.

What else is included?

Top

Whatever else that CGI::Carp exports (confess, croak, and carp).

BUGS

Top

Please report any bugs or feature requests to bug-cgi-carp-fatals@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI-Carp-Fatals. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

REQUIREMENTS

Top

HTML::Perlinfo

SEE ALSO

Top

CGI::Carp, HTML::Perlinfo, CGI::Carp::DebugScreen, CGI::HTMLError, CGI::Carp::Throw.

AUTHOR

Top

Mike Accardo <mikeaccardo@yahoo.com>

COPYRIGHT

Top


CGI-Carp-Fatals documentation Contained in the CGI-Carp-Fatals distribution.

package CGI::Carp::Fatals;

use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser set_message);
use HTML::Perlinfo;
@CGI::Carp::Fatals::ISA = qw(Exporter);
@CGI::Carp::Fatals::EXPORT = (@CGI::Carp::EXPORT);
@CGI::Carp::Fatals::EXPORT_OK = qw(fatalsRemix set_message);
$CGI::Carp::Fatals::VERSION = '0.02';

sub fatalsRemix {

my($wm) = $ENV{SERVER_ADMIN} ? 
    qq[the webmaster (<a href="mailto:$ENV{SERVER_ADMIN}">$ENV{SERVER_ADMIN}</a>)] :
      "this site's webmaster";
  my ($outer_message) = <<END;
For help, please send mail to $wm, giving this error message 
and the time and date of the error.
END
  ;

my $info_option = shift || 'INFO_VARIABLES';
my $info = perlinfo($info_option);

set_message("$outer_message<p>$info</p>");

}

1;
__END__