package Packages::CGI; 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 ); our $debug = 0; our (@fatal_errors, @errors, @debug, @msgs, @hints, @notes); sub reset { @fatal_errors = @errors = @debug = @msgs = @hints = @notes = (); } sub fatal_error { push @fatal_errors, $_[0]; } sub error { push @errors, $_[0]; } sub hint { push @hints, $_[0]; } sub debug { my $lvl = $_[1] || 0; push(@debug, $_[0]) if $debug > $lvl; } sub msg { push @msgs, $_[0]; } sub note { push @notes, $_[0]; } sub notes { push @notes, [ @_ ]; } sub print_errors { return unless @fatal_errors || @errors; print '
ERROR: $_
"; } print ''; foreach (@debug) { print "$_\n"; } print '
$_
"; } print '$_
"; } } sub print_notes { foreach (@notes) { my ( $title, $note ) = @$_; my $str = ""; if ($note) { $str .= "$note
"; return $str; } } 1;