]> git.deb.at Git - deb/packages.git/blobdiff - lib/Packages/CGI.pm
show_package.pl Basic stuff works with still some rough edges and dirty
[deb/packages.git] / lib / Packages / CGI.pm
index e9d834cb16feffc43a17d2885e13457c7d4fb2ff..cac499fbc45658ddcf32663f9b20fc46592b2d01 100644 (file)
@@ -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,6 +30,9 @@ sub debug {
 sub msg {
     push @msgs, $_[0];
 }
+sub notes {
+    push @notes, [ @_ ];
+}
 sub print_errors {
     return unless @fatal_errors || @errors;
     print '<div style="background-color:#F99;font-weight:bold;padding:0.5em;margin:0;">';
@@ -45,7 +49,6 @@ sub print_debug {
        print "$_\n";
     }
     print '</pre></div>';
-
 }
 sub print_hints {
     return unless @hints;
@@ -60,5 +63,19 @@ sub print_msgs {
        print "<p>$_</p>";
     }
 }
+sub print_notes {
+    foreach (@notes) {
+       my ( $title, $note ) = @$_;
+       my $str = "";
+
+       if ($note) {
+           $str .= "<h2 class=\"pred\">$title</h2>";
+       } else {
+           $note = $title;
+       }
+       $str .= "<p>$note</p>";
+       return $str;
+    }
+}
 
 1;