X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;ds=sidebyside;f=lib%2FPackages%2FCGI.pm;h=66b442d79b4ec295e45020e31fb2732e95b79702;hb=a3e6aa1e34000d0a7faa1773bd6bc32c32cfa625;hp=cac499fbc45658ddcf32663f9b20fc46592b2d01;hpb=08852aab550de858d4e4956ea357dbc3ae713a26;p=deb%2Fpackages.git diff --git a/lib/Packages/CGI.pm b/lib/Packages/CGI.pm index cac499f..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); @@ -30,12 +32,12 @@ sub debug { sub msg { push @msgs, $_[0]; } -sub notes { +sub note { push @notes, [ @_ ]; } sub print_errors { return unless @fatal_errors || @errors; - print '
ERROR: $_
"; } @@ -43,7 +45,7 @@ sub print_errors { } sub print_debug { return unless $debug && @debug; - print ''; foreach (@debug) { print "$_\n"; @@ -52,29 +54,30 @@ sub print_debug { } sub print_hints { return unless @hints; - print ''; + print ''; foreach (@hints) { - print "'; } sub print_msgs { + print '$_
"; + print "$_
"; } print ''; foreach (@msgs) { print "'; } sub print_notes { foreach (@notes) { my ( $title, $note ) = @$_; - my $str = ""; + print '$_
"; } + print ''; if ($note) { - $str .= ""; } }$title
"; + print "$title
"; } else { $note = $title; } - $str .= "$note
"; - return $str; + print "$note