]> git.deb.at Git - deb/packages.git/blobdiff - lib/Packages/CGI.pm
Move $debug_allowed to CGI as a real constant and modify all debug() calls
[deb/packages.git] / lib / Packages / CGI.pm
index d9aceeb35eafd2dd627e503774b65caa60e0578b..66b442d79b4ec295e45020e31fb2732e95b79702 100644 (file)
@@ -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 '<div style="background-color:#F99;font-weight:bold;padding:0.5em;margin:0;">';
+    print '<div class="perror">';
     foreach ((@fatal_errors, @errors)) {
        print "<p>ERROR: $_</p>";
     }
@@ -43,7 +45,7 @@ sub print_errors {
 }
 sub print_debug {
     return unless $debug && @debug;
-    print '<div style="font-size:80%;border:solid thin grey">';
+    print '<div class="pdebug">';
     print '<h2>Debugging:</h2><pre>';
     foreach (@debug) {
        print "$_\n";
@@ -52,24 +54,26 @@ sub print_debug {
 }
 sub print_hints {
     return unless @hints;
-    print '<div>';
+    print '<div class="phints">';
     foreach (@hints) {
-       print "<p style=\"background-color:#FF9;padding:0.5em;margin:0\">$_</p>";
+       print "<p>$_</p>";
     }
     print '</div>';
 }
 sub print_msgs {
+    print '<div class="pmsgs">';
     foreach (@msgs) {
        print "<p>$_</p>";
     }
+    print '</div>';
 }
 sub print_notes {
     foreach (@notes) {
        my ( $title, $note ) = @$_;
 
-       print '<div style="border: solid thin black; background-color: #ccf">';
+       print '<div class="pnotes">';
        if ($note) {
-           print "<h2 class=\"pred\">$title</h2>";
+           print "<h2>$title</h2>";
        } else {
            $note = $title;
        }