in reply to Using LWP::Parallel::UserAgent with perlapp/perl2exe
Any ideas?
Sure, besides the get a real OS one. -> Use the source Luke. You can see from the debug output that it tries to connect to all 5 URLs so the forking seems intact but is getting 'Failed connection for' errors in the _check_bandwith() function. In fact you can follow the stack trace from beginning to end. Here is a single failure:
LWP::Parallel::UserAgent::_check_bandwith: (LWP::Parallel::UserAgent:: +Entry=HASH(0xe0f768) [http://www.cnn.com] ) LWP::Parallel::UserAgent::on_connect: (http://www.cnn.com) LWP::Parallel::UserAgent::_connect: (LWP::Parallel::UserAgent::Entry=H +ASH(0xe0f768) [http://www.cnn.com] ) LWP::Parallel::UserAgent::init_request: -> (HTTP::Request=HASH(0xa0c23 +c)) [GET http://www.cnn.com] LWP::Parallel::UserAgent::init_request: GET http://www.cnn.com LWP::UserAgent::_need_proxy: Not proxied LWP::Parallel::UserAgent::on_failure: (http://www.cnn.com) LWP::Parallel::UserAgent::_check_bandwith: Failed connection for 'www. +cnn.com:80 '
If you follow through the code you will be able to see that..... the error comes from init_request, which returns a (possibly useful error message) which is them simply ignored due to the calling syntax.
1) LWP::Parallel::UserAgent::_check_bandwith: (LWP::Parallel::UserAgen +t::Entry=HASH(0xe0f768) [http://www.cnn.com] ) 2) LWP::Parallel::UserAgent::on_connect: (http://www.cnn.com) 3) LWP::Parallel::UserAgent::_connect: (LWP::Parallel::UserAgent::Entr +y=HASH(0xe0f768) [http://www.cnn.com] ) 4) LWP::Parallel::UserAgent::init_request: -> (HTTP::Request=HASH(0xa0 +c23c)) [GET http://www.cnn.com] 5) LWP::Parallel::UserAgent::init_request: GET http://www.cnn.com 6) LWP::UserAgent::_need_proxy: Not proxied 7) LWP::Parallel::UserAgent::on_failure: (http://www.cnn.com) 8) LWP::Parallel::UserAgent::_check_bandwith: Failed connection for 'w +ww.cnn.com:80 ' # this method checks the available bandwith and either connects # the request and returns 1, or, in case we didn't have enough # bandwith, returns undef sub _check_bandwith { my ( $self, $entry ) = @_; #1 LWP::Debug::trace("($entry [".$entry->request->url."] )"); ..... } elsif ( $self->_hosts_available ) { #2 $self->on_connect ( $request, $response, $entry ); #3 unless ( $self->_connect ( $entry ) ) { # only increase connection count if _connect doesn't return er +ror $self->{'current_connections'}->{$netloc}++; } else { # calling ->on_failure is done within ->_connect #8 LWP::Debug::debug ("Failed connection for '" . $netloc ."'") +; $self->{'failed_connections'}->{$netloc}++; ..... } sub _connect { my ($self, $entry) = @_; #3 LWP::Debug::trace("($entry [".$entry->request->url."] )"); local($SIG{"__DIE__"}); # protect against user defined die hand +lers my ( $request, $response ) = $entry->get( qw(request response) ); my ($error_response, $proxy, $protocol, $timeout, $use_eval, $nonb +lock) = #4 $self->init_request ($request); if ($error_response) { # we need to manually set code and message of $response as wel +l, so # that we have the correct information in our $entry as well $response->code ($error_response->code); $response->message ($error_response->message); #7 $self->on_failure ($request, $error_response, $entry); return $error_response; }
I suggest this patch for a start so you can read the error message:
} elsif ( $self->_hosts_available ) { $self->on_connect ( $request, $response, $entry ); my $err_msg = $self->_connect ( $entry ); unless ( $err_msg ) { # only increase connection count if _connect doesn't retur +n error $self->{'current_connections'}->{$netloc}++; } else { # calling ->on_failure is done within ->_connect LWP::Debug::debug ("Failed connection for '" . $netloc ."' +\nError: $err_msg"); $self->{'failed_connections'}->{$netloc}++;
cheers
tachyon
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using LWP::Parallel::UserAgent with perlapp/perl2exe
by ldln (Pilgrim) on Sep 10, 2004 at 18:22 UTC |