X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=lib%2FPackages%2FCGI.pm;h=e15e510f017edd512b27cb53426825844a524be4;hb=47c93cb066364b11f0b216589ddc68671435b060;hp=e9d834cb16feffc43a17d2885e13457c7d4fb2ff;hpb=9c048903c83d44428f638e77df45daaf076362c6;p=deb%2Fpackages.git diff --git a/lib/Packages/CGI.pm b/lib/Packages/CGI.pm index e9d834c..e15e510 100644 --- a/lib/Packages/CGI.pm +++ b/lib/Packages/CGI.pm @@ -2,15 +2,16 @@ package Packages::CGI; use Exporter; our @ISA = qw( Exporter ); -our @EXPORT = qw( fatal_error error hint debug msg - print_errors print_hints print_debug print_msgs ); +our @EXPORT = qw( fatal_error error hint debug msg note + print_errors print_hints print_debug print_msgs + print_notes ); our $debug = 0; -our (@fatal_errors, @errors, @debug, @msgs, @hints); +our (@fatal_errors, @errors, @debug, @msgs, @hints, @notes); sub reset { - @fatal_errors = @errors = @debug = @msgs = @hints = (); + @fatal_errors = @errors = @debug = @msgs = @hints = @notes = (); } sub fatal_error { @@ -29,9 +30,12 @@ sub debug { sub msg { push @msgs, $_[0]; } +sub note { + push @notes, [ @_ ]; +} sub print_errors { return unless @fatal_errors || @errors; - print '
'; + print '
'; foreach ((@fatal_errors, @errors)) { print "

ERROR: $_

"; } @@ -39,26 +43,40 @@ sub print_errors { } sub print_debug { return unless $debug && @debug; - print '
'; + print '
'; print '

Debugging:

';
     foreach (@debug) {
 	print "$_\n";
     }
     print '
'; - } 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 '
'; + if ($note) { + print "

$title

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

$note

"; + } } 1;