Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > help on LWP::Parallel

Reply
Thread Tools

help on LWP::Parallel

 
 
jliang888@yahoo.com
Guest
Posts: n/a
 
      03-08-2005
Is there anyway can make my script continue to run? If I just run 1st
and 2nd or 1st and 3rd in the request list, the script won't be
terminated, but it will be broken when list contains both 2nd and 3rd
URLs.

#!/usr/bin/perl -w
require LWP:arallel::UserAgent;
use HTTP::Request;

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

# shortcut for demo URLs

my $reqs = [
HTTP::Request->new('GET', 'http://www.yahoo.com'),
HTTP::Request->new('GET', 'http://www.oceanestatesa.com'),
HTTP::Request->new('GET',
'http://www.oceanstatenautical.com'),
];

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

foreach my $req (@$reqs) {
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";
}



Thnaks.


J.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Help Help Pentax S5i Help needed (Please) The Martian Digital Photography 14 06-20-2008 07:56 AM
HELP - HELP - HELP =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?= ASP .Net 4 03-09-2006 12:46 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 1 07-16-2004 01:12 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 0 07-16-2004 10:00 AM
HELP! HELP! HELP! Opening Web Application Project Error =?Utf-8?B?dHJlbGxvdzQyMg==?= ASP .Net 0 02-20-2004 05:16 PM



Advertisments