X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=lib%2FPackages%2FCGI.pm;h=66b442d79b4ec295e45020e31fb2732e95b79702;hb=f27f1fcc5bffc0696f694e962eb40dbb0c554855;hp=d9aceeb35eafd2dd627e503774b65caa60e0578b;hpb=3210a2b7d904e95b48ebbd84afa2bf1875544e8e;p=deb%2Fpackages.git diff --git a/lib/Packages/CGI.pm b/lib/Packages/CGI.pm index d9aceeb..66b442d 100644 --- a/lib/Packages/CGI.pm +++ b/lib/Packages/CGI.pm @@ -4,8 +4,10 @@ use Exporter; our @ISA = qw( Exporter ); our @EXPORT = qw( fatal_error error hint debug msg note print_errors print_hints print_debug print_msgs - print_notes ); + print_notes DEBUG ); +# define this to 0 in production mode +use constant DEBUG => 1; our $debug = 0; our (@fatal_errors, @errors, @debug, @msgs, @hints, @notes); @@ -35,7 +37,7 @@ sub note { } sub print_errors { return unless @fatal_errors || @errors; - print '
'; + print '
'; foreach ((@fatal_errors, @errors)) { print "

ERROR: $_

"; } @@ -43,7 +45,7 @@ sub print_errors { } sub print_debug { return unless $debug && @debug; - print '
'; + print '
'; print '

Debugging:

';
     foreach (@debug) {
 	print "$_\n";
@@ -52,24 +54,26 @@ sub print_debug {
 }
 sub print_hints {
     return unless @hints;
-    print '
'; + print '
'; foreach (@hints) { - print "

$_

"; + print "

$_

"; } print '
'; } sub print_msgs { + print '
'; foreach (@msgs) { print "

$_

"; } + print '
'; } sub print_notes { foreach (@notes) { my ( $title, $note ) = @$_; - print '
'; + print '
'; if ($note) { - print "

$title

"; + print "

$title

"; } else { $note = $title; }