Show us a bit more of your own code.
Ok, I first:
package PUA; use LWP::Parallel::UserAgent; @PUA::ISA = qw(LWP::Parallel::UserAgent); sub on_return { # print '@_ = (' . join(', ',map{"'$_'"} @_) .")\n"; my ($self,$request, $response, $entry) = @_; $self->discard_entry($entry); } 1;
#!/usr/bin/perl use strict; use Data::Dumper; $Data::Dumper::Indent = 1; use HTTP::Request; use PUA; my $ua = PUA->new(); for(<*.pl>) { my $request = HTTP::Request->new('GET',"file://$ENV{HOME}/perlmonk +s/$_"); if( my $res = $ua->register($request)) { print STDERR $res->error_as_HTML; } } print Dumper($ua);
Output:
$VAR1 = bless( { 'ordpend_connections' => [], 'entries_by_sockets' => {}, 'max_hosts' => 7, 'seen_request' => {}, 'handle_duplicates' => 0, 'requests_redirectable' => [ 'GET', 'HEAD' ], 'from' => undef, 'timeout' => 180, 'handle_response' => 1, 'parse_head' => 1, 'remember_failures' => 0, 'entries_by_requests' => {}, 'max_req' => 5, 'current_connections' => {}, 'max_redirect' => 7, 'nonblock' => 0, 'previous_requests' => {}, 'select_out' => bless( [ undef, 0 ], 'IO::Select' ), 'pending_connections' => {}, 'failed_connections' => {}, 'protocols_forbidden' => undef, 'no_proxy' => [], 'protocols_allowed' => undef, 'use_eval' => 1, 'agent' => 'libwww-perl/5.805', 'handle_in_order' => 0, 'def_headers' => undef, 'proxy' => {}, 'select_in' => bless( [ undef, 0 ], 'IO::Select' ), 'max_size' => undef }, 'PUA' );
Works like expected. No Request/Response object in $ua. If I comment out the $self->discard_entry($entry) line in PUA.pm, the $ua object is stuffed with the entries in the anonymous array keyed as ordpend_connections in the object's hash.
Your turn. I suspect usage errors.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re: Problems with 'discard_entry' in LWP::Parallel::Useragent
by shmem
in thread LWP::Parallel::UserAgent discard_entry does not delete entry objects
by perlmonkey2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |