#!/usr/bin/perl use LWP::Parallel; use HTTP::Request; use LWP::Debug qw(+); my ($res); my $reqs=[ HTTP::Request->new('GET', 'http://www.somesite.com/index.html') ]; my $pua = LWP::Parallel::UserAgent->new(); $pua->max_hosts(15); $pua->max_req(15); $pua->in_order(1); foreach my $req (@$reqs) { my $a=$pua->register ($req); print "Registered: $req->url\n"; } my $entries = $pua->wait(); foreach (keys %$entries) { my $res = $entries->{$_}->response; my $content = $res->message; # not sure about previous line print $content; }
When I run it, it produces the following:
LWP::UserAgent::new: () LWP::Parallel::UserAgent::max_hosts: (15) LWP::Parallel::UserAgent::max_req: (15) LWP::Parallel::UserAgent::in_order: (1) LWP::Parallel::UserAgent::register: (http://www.somesite.com/index.htm +l, [undef], [undef], [undef]) Registered: HTTP::Request=HASH(0x805780c)->url LWP::Parallel::UserAgent::wait: Current Server: 0 [ ] Pending Server: 1 LWP::Parallel::UserAgent::_make_connections_in_order: () LWP::Parallel::UserAgent::_check_bandwith: (LWP::Parallel::UserAgent:: +Entry=HASH(0x805b03c) [http://www.somesite.com/index.html] ) LWP::Parallel::UserAgent::on_connect: (http://www.somesite.com/index.h +tml) LWP::Parallel::UserAgent::_connect: (LWP::Parallel::UserAgent::Entry=H +ASH(0x805b03c) [http://www.somesite.com/index.html] ) LWP::Parallel::UserAgent::init_request: -> (HTTP::Request=HASH(0x80578 +0c)) [GET http://www.somesite.com/index.html] LWP::Parallel::UserAgent::init_request: GET http://www.somesite.com/in +dex.html LWP::UserAgent::_need_proxy: Not proxied LWP::Parallel::Protocol::implementor: Try autoloading LWP::Parallel::P +rotocol::http LWP::Parallel::UserAgent::init_request: <- (undef, [undef], LWP::Paral +lel::Protocol::http=HASH(0x805b168), 180, 1) LWP::Parallel::UserAgent::on_failure: (http://www.somesite.com/index.h +tml) Can't locate object method "new" via package "LWP::Parallel::Protocol: +:http::Socket".
I tried to trace the call of http::Socket. It seems like I have problems with http.pm library or libnet (a part of LWP now). I have all needed libraries installed as far as I understand reading LWP's manual. And I have http.pm. If anyone ever had a problem like this, I'd like to here from him. Thanks a lot. I'm looking to hearing from you. My E-mail is nikos@hotbox.ru.

In reply to LWP::Parallel Doesn't Work For Me by nikos

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.