#!/usr/bin/perl -- # $Id: album_display.pm,v 1.3 2004/09/13 15:28:10 bobbitt Exp $ ######################## START OF POD ######################## =head1 NAME display.pm - error, display and debug functions for album.pl. =head1 INFORMATION Author: J.J.Frister, taken from album.pl Mike Bobbitt (Mike@Bobbitt.ca), Cipher Logic Canada Inc. For updates, instructions and examples see http://perl.bobbitt.ca/forums on the web. =head1 LICENSE This program is © 1999-2004 Cipher Logic Canada Inc. & © 2004 fristersoft. All Rights Reserved. As long as you leave this POD section and my contact info above in tact, feel free to use this as you see fit. You can pretty much do anything with this script except resell it. :) If you come up with any good modifications to it, please let me know. I'd love to fold your mod into the public version (with credit, of course). Good luck! =head1 SUBROUTINES =cut ######################## END OF POD ######################## ######################## START OF SUBROUTINES ######################## ########################################################################## =head3 error_sub() error_sub($line,$error,$extra_info,$module); $line - Line number, where error occurred. $error - Pre-defined error code that prints a canned message. $extra_info - Additional information that can be passed in. $module - Module name (optional). Displayes the error message associated with $error along with the $extra_info. Then halts execution. =cut sub error_sub { my $error; my $error_header; my $errstring; my $line=shift; my $error=shift; my $extra_info=shift; my $module=shift; printHTMLHeader(); # Fill in some vars if strings weren't loaded properly if (!$::S{18}) { $::S{18}="ERROR! (No stringtable loaded)"; $::S{19}="Error: Line"; } $error_header="
\n$::S{22}"; } elsif ($error eq "not_writable") { $errstring="$::S{23} $extra_info ($!)\n"; } elsif ($error eq "stringtable") { $errstring="String table is not found! Cannot continue execution. $extra_info\n"; } elsif ($error eq "sanity") { $errstring="$::S{24} $extra_info\n"; } elsif ($error eq "upload_error") { $errstring="$::S{25} $extra_info\n"; } elsif ($error eq "open_db") { $errstring="$::S{26} $extra_info ($!)\n"; } elsif ($error eq "short_stringtable") { $errstring="Your string table ($::stringtable) is too short: $extra_info\n"; } elsif ($error eq "cant_append") { $errstring="$::S{27} $extra_info ($!)\n"; } elsif ($error eq "upload_dir") { $errstring="$::S{28} $extra_info ($!)\n"; } elsif ($error eq "reg_error") { $errstring="$::S{30} $extra_info\n"; } elsif ($error eq "no_config") { $errstring="$::S{31} ($extra_info).\n
$::S{32} $0 $::S{33}\n"; } elsif ($error eq "cant_fork") { $errstring="Cannot fork: $extra_info.\n"; } else { # Handle error codes not listed above $errstring="$::S{34} $error ($extra_info)
\n$::S{35}\n"; } # Print error info display("$errstring
\n"); display("
"); if ($module) { display("[$module] "); } if ($line) { display("$line: "); } display("$debug_message\n"); # Leaving subroutine if ($debug_message=~/^Leaving subroutine:/i) { display(""); } } } ########################################################################## =head3 javaAlert() $javastuff=javaAlert($message); $message - Message to display $javastuff - HTML/JavaScript code to display a popup. Returns HTML/JavaScript code to display $message as a javascript "alert" popup. =cut sub javaAlert { my $message=shift; my $javastuff; $javastuff="\n"; return($javastuff); } ########################################################################## ######################## END OF SUBROUTINES ######################## ######################## END OF FILE ######################## 1;