############################################################################## # # # weberror.pm - A simple way to create an error web page. # # # # Revision: 1.0 11/26/97 # # # # Author: David Harris # # # # History: None yet. # # # # # # COPYRIGHT (C) 1997 David R. Harris All Rights Reserved. # # # ############################################################################## package weberror; ############################################################################## # SUB: error($error_msg) # Prints out a simple error message. Does not die, just prints and returns. sub error { my ($error_msg) = @_; $error_msg =~ s//>/g; $error_msg =~ s/\n/
/g; ## $error_msg =~ s/
(?!\n)/
\n/g; print <<"EOHD"; Error!

Ack! There has been an error

There has been an error inside of this program. If you beleive this error is out of your jurisdiction (you didn't do anything wrong), please contact the server administrator at $ENV{SERVER_ADMIN} with the following error information and a brief description of how you got this error.

    $error_msg

    Script URL = $ENV{SCRIPT_URI}
    Request method = $ENV{REQUEST_METHOD}
    User agent = $ENV{HTTP_USER_AGENT}

    Stack backtrace:
    EOHD my $i = 1; while ( 1 ) { my ($package, $filename, $line, $subroutine, $hasargs, $wantargs) = caller($i); last if ($package eq '' || $i > 30 ); $filename =~ s#^.*/##; print "\t\tFrame $i: $filename, $subroutine, line $line
    \n"; $i++; } print <<"EOHD";

Thanks,
The Server Administrator
EOHD } ############################################################################## # SUB: debug_report( [ $form_info | undef ] , [ $debug_string | undef ] ) # Prints out a simple debug report, optionally given form info. sub debug_report { my ($form_info, $debug_string) = @_; my ($print_line); print <<"EOHD";

Debugging Report

EOHD

	print "Enviorment is:\n";
	foreach $this_key ( sort keys(%ENV) ) {
		$print_line = "$this_key = '$ENV{$this_key}'\n";
		$print_line =~ s//>/g;
		print $print_line;
	}

	if ( defined $form_info ) {
		print "\nForm info is:\n";
		$form_info->print();
	}

	if ( defined $debug_string ) {
		print "\nDebug string info is:\n";
		$debug_string =~ s//>/g;
	###	$debug_string =~ s/\n/
/g; print $debug_string; } print <<"EOHD";
EOHD } 1; # Required for packages