]> git.deb.at Git - deb/packages.git/commitdiff
Forgot to commit some new files related to the mod_perl changes
authorFrank Lichtenheld <frank@lichtenheld.de>
Sat, 4 Feb 2006 00:12:06 +0000 (00:12 +0000)
committerFrank Lichtenheld <frank@lichtenheld.de>
Sat, 4 Feb 2006 00:12:06 +0000 (00:12 +0000)
bin/mod_perl-startup [new file with mode: 0644]
lib/Packages/CGI.pm [new file with mode: 0644]

diff --git a/bin/mod_perl-startup b/bin/mod_perl-startup
new file mode 100644 (file)
index 0000000..47d4b5d
--- /dev/null
@@ -0,0 +1,5 @@
+#!/usr/bin/perl
+
+use lib "/org/packages.debian.org/lib";
+
+1;
diff --git a/lib/Packages/CGI.pm b/lib/Packages/CGI.pm
new file mode 100644 (file)
index 0000000..e9d834c
--- /dev/null
@@ -0,0 +1,64 @@
+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 $debug = 0;
+
+our (@fatal_errors, @errors, @debug, @msgs, @hints);
+
+sub reset {
+    @fatal_errors = @errors = @debug = @msgs = @hints = ();
+}
+
+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 print_errors {
+    return unless @fatal_errors || @errors;
+    print '<div style="background-color:#F99;font-weight:bold;padding:0.5em;margin:0;">';
+    foreach ((@fatal_errors, @errors)) {
+       print "<p>ERROR: $_</p>";
+    }
+    print '</div>';
+}
+sub print_debug {
+    return unless $debug && @debug;
+    print '<div style="font-size:80%;border:solid thin grey">';
+    print '<h2>Debugging:</h2><pre>';
+    foreach (@debug) {
+       print "$_\n";
+    }
+    print '</pre></div>';
+
+}
+sub print_hints {
+    return unless @hints;
+    print '<div>';
+    foreach (@hints) {
+       print "<p style=\"background-color:#FF9;padding:0.5em;margin:0\">$_</p>";
+    }
+    print '</div>';
+}
+sub print_msgs {
+    foreach (@msgs) {
+       print "<p>$_</p>";
+    }
+}
+
+1;