X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=lib%2FPackages%2FCGI.pm;h=66b442d79b4ec295e45020e31fb2732e95b79702;hb=dc1f8cc1360f5abb632e30e72753e2e132ff9290;hp=cc92e64d6f748c6496c7e0205f7df733a62692a7;hpb=ef769eaccb9ebf7f49b8c3240c9c4d6980072ee5;p=deb%2Fpackages.git diff --git a/lib/Packages/CGI.pm b/lib/Packages/CGI.pm index cc92e64..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; }