So I've got my project running, and naturally some tuning and bugfixing is
in order.
All of the changes are happening in my DBFetch module. Little modifications
as to what gets incremented where, in the local heap.
But alla sudden, my HTML reports are CRASHING the program!?!
My HTML section works like this:
================================
package WebSession;
# ...
sub _start {
# ... init other stuff
$heap->{wheel} = POE::Wheel::ReadWrite->new
( Handle => $handle, # on this handle
Driver => POE::Driver::SysRW->new, # using sysread and syswrite
Filter => POE::Filter::HTTPD->new, # parsing I/O as http
requests
InputState => 'receive', # generating this event for requests
ErrorState => 'error', # generating this event for errors
FlushedState => 'flushed', # generating this event for all-sent
);
# ... finish module init
}
my %command = (
'/' => 'html_dump',
'/dump' => 'html_dump',
'/hitq' => 'html_hitq',
'/list' => 'html_status',
);
sub receive {
my ($kernel, $heap, $sender, $request) = @_[KERNEL, HEAP, SENDER, ARG0];
DEBUG && print "Received a request from $heap->{host} : $heap->{port}
for ${\($request->uri)}\n";
# create a response for the request
my $response;
unless ($request->authorization_basic
and $request->authorization_basic eq 'XXXXX:XXXXX') {
$response = HTTP::Response->new('401');
$response->www_authenticate('Basic realm="test"');
$response->content_type('text/html');
return $heap->{wheel}->put($response);
}
$response = HTTP::Response->new('200');
$response->content_type('text/html');
$kernel->post( db => ($command{ $request->uri } || 'html_dump') =>
$sender->postback( reply => $request, $response ) );
}
sub reply {
my ($object, $heap, $request, $content) = @_[OBJECT, HEAP, ARG0, ARG1];
my $response = $request->[1];
DEBUG && print "$object printing reply\n";
$response->content($content->[0]);
if (defined $heap->{wheel}) {
$heap->{wheel}->put($response)
} else {
warn "$object ERROR -- Missing wheel!\n" if DEBUG;
}
}
==================
And the HTML sections of my DBFetch module say:
==================
sub html_dump {
my ($object, $kernel, $heap, $sender, $postback, $response) =
@_[OBJECT, KERNEL, HEAP, SENDER, ARG0, ARG1];
my ($content);
# start an html document in $content
$content = start_html('Heap Dump');
# ... append more html to $content
$postback->($content);
}
==================
(several variations exist, *ONLY* differing in the html content).
This code, which has worked perfectly thru development, testing, and
rollout, SUDDENLY kills the program as to TODAY with:
Didn't want any more data
Which I finally found in Filter::HTTPD but I can't figure out what condition
will trigger this.
So, will somebody PLEASE tell me how/what/where this broke? Did I miss
something?
FWIW, AFAIK it's only IE that kills it. lwp-request (i.e. GET) doesn't, and
lynx seems to be fine so far too. But this error is too weird to rule out
the other browsers causing it here in the next couple of minutes.
And while I'm at it,
I tried to catch this (among other) problem by wrapping the call to ->run()
in an eval block:
==================
# ... startup stuff.
package main;
use vars qw/$QUIT $try/;
$QUIT = 0;
$try = 0;
until ($QUIT) {
eval {
print STDERR "QD: Starting at ", time2iso(), "\n";
Bootstrap->new();
$poe_kernel->run();
};
unless ($QUIT) {
if ($try < 3 ) { # incremented elsewhere
print STDERR "QD: Died unexpectedly ($@). Restarting\n";
} else {
$QUIT++;
}
}
}
print STDERR "QD: Exiting at ", time2iso(), "\n";
exit;
==================
but my program still dies after printing "Didn't want any more data".
Again, WHAT DID I MISS???
TIA!
L8r,
Rob
#!/usr/bin/perl -w
use Disclaimer qw/:standard/;