Adding more debug code to make my life easier.

This commit is contained in:
ian%hixie.ch 2002-11-02 17:56:51 +00:00
parent 6c91eb5274
commit 574e9443e3
4 changed files with 9 additions and 3 deletions

View File

@ -30,6 +30,7 @@ package PLIF;
use strict; # require strict adherence to perl standards use strict; # require strict adherence to perl standards
use vars qw($AUTOLOAD); # it's a package global use vars qw($AUTOLOAD); # it's a package global
use Carp qw(cluck confess); # stack trace versions of warn and die use Carp qw(cluck confess); # stack trace versions of warn and die
use POSIX qw(strftime); # timestamps in debug output
my $DEBUG = 9; # level of warnings and dumps to print to STDERR (none go to user) my $DEBUG = 9; # level of warnings and dumps to print to STDERR (none go to user)
my $USER = 1; # level of errors to report to user (all go to STDERR) my $USER = 1; # level of errors to report to user (all go to STDERR)
my @FATAL = (); # a list of pointers to functions that want to report errors to the user my @FATAL = (); # a list of pointers to functions that want to report errors to the user
@ -187,8 +188,9 @@ sub dump {
my $self = shift; my $self = shift;
my($level, @data) = @_; my($level, @data) = @_;
if ($self->isAtDebugLevel($level)) { if ($self->isAtDebugLevel($level)) {
my $time = strftime('%Y-%m-%d %H:%M:%S UTC', gmtime());
foreach (@data) { foreach (@data) {
print STDERR "$0: ($level) $_\n"; print STDERR "$0.$$ \@ $time: ($level) $_\n";
} }
} }
} }

View File

@ -43,8 +43,9 @@ sub applies {
sub decodeHTTPArguments { sub decodeHTTPArguments {
my $self = shift; my $self = shift;
if (defined($ENV{'QUERY_STRING'})) { if (defined($ENV{'QUERY_STRING'})) {
$self->dump(9, 'HTTP GET. Input was: ' . $ENV{'QUERY_STRING'});
$self->splitURLEncodedForm($ENV{'QUERY_STRING'}, sub { $self->addArgument(@_); }) $self->splitURLEncodedForm($ENV{'QUERY_STRING'}, sub { $self->addArgument(@_); })
} else { } else {
# XXX no arguments $self->dump(9, 'HTTP GET. No input.');
} }
} }

View File

@ -64,6 +64,8 @@ sub decodeHTTPArguments {
} }
# XXX END OF PLATFORM SPECIFIC CODE XXX # XXX END OF PLATFORM SPECIFIC CODE XXX
$self->dump(9, 'HTTP POST. Input was in multipart/form-data format.');
# parse the MIME body # parse the MIME body
local $/ = undef; local $/ = undef;
my $entity = $parser->parse_data('Content-Type: ' . $self->CONTENT_TYPE . "\n" . my $entity = $parser->parse_data('Content-Type: ' . $self->CONTENT_TYPE . "\n" .

View File

@ -46,5 +46,6 @@ sub decodeHTTPArguments {
my $self = shift; my $self = shift;
local $/ = undef; local $/ = undef;
my $input = <STDIN>; my $input = <STDIN>;
$self->dump(9, 'HTTP POST. Input was: ' . $input);
$self->splitURLEncodedForm($input, sub { $self->addArgument(@_); }) $self->splitURLEncodedForm($input, sub { $self->addArgument(@_); })
} }