water has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I'm tinkering with meryln's parallel linker in POE. After running for a bit, the code segfaults with this error from deep w/in POE

Can't call method "previous" on an undefined value at /usr/lib/perl5/s +ite_perl/5.8.2/POE/Component/Client/HTTP.pm line 1165. Segmentation fault
Suggestions, wise monks?

water

Replies are listed 'Best First'.
Re: POE Client HTTP error
by revdiablo (Prior) on Nov 22, 2004 at 18:41 UTC

    Lacking any indication of the problem except the error you pasted, I looked at the PoCo::Client::HTTP source on CPAN. Near line 1165, this is what I found (trimmed a bit for pasting):

    sub _respond { my($heap, $request_id, $request) = @_; my $response = $request->[REQ_RESPONSE]; if ($heap->{frmax}) { if ($heap->{redir}->{$request_id}->{followed}) { # ... } else { my $tmpresponse = $response; while (defined ...) { my $prev = $heap->{redir}->{$request_id}->{from}; $tmpresponse->previous(...); $tmpresponse = $tmpresponse->previous(); $request_id = $prev; } } } $request->[REQ_POSTBACK]->($response); }

    Assuming this is the same version you're using, or the line numbers are close enough that this is the code in question, it looks like previous is being called several times on $tmpresponse. This is a copy of $response, which in turn is a copy of $request->[REQ_RESPONSE].

    Just guessing from that code, and the error you pasted, it looks like the response is undefined. The code should probably check for that possibility, but it doesn't appear to. Perhaps this is a bug that should be reported, but I'm just doing guesswork based on the scant evidence presented. :-)