Can′t come along with LWP::Para llel::UserAgent, any ideas why?? 
Author Message
 Can′t come along with LWP::Para llel::UserAgent, any ideas why??


for some time I am trying to get a little perlscript running, using
the above mentioned module. My intention ist to fetch some URL
parallely, thats it, nothing more...

Ive tried it with some code I found in the net an customized it to my
need, would be very nice if anyone could tell me whats wrong or give
me a hint at least...

Many thanks in advance... Tim

#############################################################

#!/usr/bin/perl -w  

require LWP::Parallel::UserAgent;
  use HTTP::Request;

  # display tons of debugging messages. See 'perldoc LWP::Debug'
  use LWP::Debug qw(+);

  # shortcut for demo URLs
  my %url = (" http://www.*-*-*.com/ ;," http://www.*-*-*.com/ "," http://www.*-*-*.com/ ");

foreach $key (keys(%url))     {
        my $reqs = [  
        HTTP::Request->new('GET', $key)
                         ];
                                 }

  my $pua = LWP::Parallel::UserAgent->new();
  $pua->in_order  (1);  # handle requests in order of registration
  $pua->duplicates(0);  # ignore duplicates
  $pua->timeout   (10); # in seconds
  $pua->redirect  (0);  # follow redirects


    print "Registering '".$req->url."'\n";
    if ( my $res = $pua->register ($req) ) {
        print STDERR $res->error_as_HTML;
    }  
  }
  my $entries = $pua->wait();

  foreach (keys %$entries) {
    my $res = $entries->{$_}->response;

    print "Answer for '",$res->request->url, "' was \t", $res->code,":
",
          $res->message,"\n";
  }

##############################################################################



Sun, 18 Apr 2004 21:46:00 GMT  
 Can′t come along with LWP::Para llel::UserAgent, any ideas why??

Quote:

>  my %url = ("http://www.drweb.de/","http://www.fireball.de","http://www.google.de");

I haven't looked at the rest of your code when I saw this line.

--
        Bart.



Sun, 18 Apr 2004 22:38:22 GMT  
 Can′t come along with LWP::Para llel::UserAgent, any ideas why??

Quote:


> for some time I am trying to get a little perlscript running, using
> the above mentioned module. My intention ist to fetch some URL
> parallely, thats it, nothing more...

> Ive tried it with some code I found in the net an customized it to my
> need, would be very nice if anyone could tell me whats wrong or give
> me a hint at least...

> Many thanks in advance... Tim

> #############################################################

> #!/usr/bin/perl -w

use strict;

Quote:
> require LWP::Parallel::UserAgent;

  use LWP::Parallel::UserAgent ();

Quote:
>   use HTTP::Request;

    use HTTP::Request ();

Quote:

>   # display tons of debugging messages. See 'perldoc LWP::Debug'
>   use LWP::Debug qw(+);

>   # shortcut for demo URLs
>   my %url = ("http://www.drweb.de/", "http://www.fireball.de",
>              "http://www.google.de");

Your brane must have been offline at the time you wrote that code.


                 http://www.fireball.de/
                 http://www.google.de/);

Quote:
> foreach $key (keys(%url))     {
>         my $reqs = [
>         HTTP::Request->new('GET', $key)
>                          ];
>                                  }

Your variable $reqs is lexically scoped to the foreach loop.
It's not visible below here.


Quote:

>   my $pua = LWP::Parallel::UserAgent->new();
>   $pua->in_order  (1);  # handle requests in order of registration
>   $pua->duplicates(0);  # ignore duplicates
>   $pua->timeout   (10); # in seconds
>   $pua->redirect  (0);  # follow redirects



There is no $reqs.  There is only Zuul.


I suppose the rest of it is probably ok... I haven't looked at it.

--
Klein bottle for rent - inquire within.



Sun, 25 Apr 2004 03:05:36 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Trouble with LWP::UserAgent setting UserAgent

2. ANNOUNCE: Perl tut # 17 - MS Word doc to text, para by para

3. LWP - cannot destroy LWP::UserAgent

4. Early Perl 5.8.0 and LWP::Simple and LWP::UserAgent

5. lwp-request warnings coming from Net::Domain

6. lwp-request warnings coming from Net::Domain

7. Any Ideas ? HTTP::UserAgent

8. Why is my hash coming untied?

9. LWP::UserAgent authenticating with ntlm

10. LWP::UserAgent and Cookies

11. LWP Question: UserAgent vs Robot

12. libwww: LWP::UserAgent not flushing buffers?

 

 
Powered by phpBB® Forum Software