You changed my code, so it works now? If not, just try. I have no idea, why it is not working at me, really. Please help.All right. wait is not responsible for actualy making the request. How do I know?
Now since most of these aren't documented, the time comes to source dive. I start by examining LWP::Parallel::Protocol::http::write_request (since it is responsible for making the request as evident by the trace), and I seeC:\>perl -MLWP::Debug=+ foobar.pl LWP::UserAgent::new: () LWP::Parallel::UserAgent::in_order: (0) ***********snip********** LWP::Parallel::UserAgent::register: (http://2ge.mine.nu/headers.php, [ +undef], [undef], [undef]) LWP::Parallel::UserAgent::wait: Current Server: 0 [ ] Pending Server: 1 [ 2ge.mine.nu:80, 10 ] LWP::Parallel::UserAgent::_make_connections_unordered: () LWP::Parallel::UserAgent::_check_bandwith: (LWP::Parallel::UserAgent:: +Entry=HASH(0x1cbaf28) [http://2ge.mine.nu/headers.php] ) ***********snip********** LWP::Parallel::UserAgent::on_connect: (http://2ge.mine.nu/headers.php) LWP::Parallel::UserAgent::_connect: (LWP::Parallel::UserAgent::Entry=H +ASH(0x1cbb174) [http://2ge.mine.nu/headers.php] ) LWP::Parallel::UserAgent::init_request: -> (HTTP::Request=HASH(0x1cabe +6c)) [GET http://2ge.mine.nu/headers.php] LWP::Parallel::UserAgent::init_request: GET http://2ge.mine.nu/headers +.php LWP::UserAgent::_need_proxy: Not proxied LWP::Parallel::UserAgent::init_request: <- (undef, [undef], LWP::Paral +lel::Protocol::http=HASH(0x1d39fa4), 10, 1) LWP::Parallel::Protocol::http::_connect: Socket is IO::Socket::INET=GL +OB(0x1d3a058) LWP::Parallel::UserAgent::_check_bandwith: (LWP::Parallel::UserAgent:: +Entry=HASH(0x1cbb288) [http://2ge.mine.nu/headers.php] ) ***********snip********** LWP::Parallel::UserAgent::_perform_write: Writing to Sockets LWP::Parallel::Protocol::http::write_request: write_request (HTTP::Req +uest=HASH(0x1cac16c), IO::Socket::INET=GLOB(0x1d3e62c), /headers.php, + [undef], 1 0, [undef]) LWP::Parallel::Protocol::http::write_request: GET /headers.php HTTP/1. +0 Host: 2ge.mine.nu User-Agent: My agent 10 ***********snip**********
but its not where the headers are set (agent isn't mentioned).sub write_request { my ($self, $request, $socket, $fullpath, $arg, $timeout, $proxy) = @ +_; ***********snip********** my $h = $request->headers->clone; ***********snip**********
So now I look earlier in the trace, and this time I notice LWP::Parallel::UserAgent::init_request, so I examine it
and would you look at that I've found where the headers (in particular User-Agent) are initialized. See how that works?***********snip********** my ($agent, $from, $timeout, $cookie_jar, $use_eval, $parse_head, $max_size, $nonblock) = @{$self}{qw(agent from timeout cookie_jar use_eval parse_head max_size nonblock)}; # Set User-Agent and From headers if they are defined $request->init_header('User-Agent' => $agent) if $agent; ***********snip**********
Do you now know what you have to do?
In reply to Re^5: LWP::Parallel in other way
by PodMaster
in thread LWP::Parallel in other way
by 2ge
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |