473,545 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help on LWP::Parallel

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::Parallel:: UserAgent;
use HTTP::Request;

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

# shortcut for demo URLs

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

my $pua = LWP::Parallel:: 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 "Registerin g '".$req->url."'\n";
if ( my $res = $pua->register ($req) ) {
print STDERR $res->error_as_HTM L;
}
}
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.

Jul 19 '05 #1
0 3872

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2578
by: Joe | last post by:
I need to connect to 10 web sites to grab content from them. I would like to connect to each site simultaneously so that I can obtain the data as fast as possible. I am familar doing this with perl by using parallel sockets or the module LWP-Parallel. So what would be the best method to do this in php? Sockets, forks? Also, if...
10
2256
by: Joshua Nussbaum | last post by:
I came up with what I think is a good idea for making multithreading programming easier in any .NET language. I dont know where else to post it, so I'll try here. ..NET 2.0 adds the capability to write anonymous functions, it would be nice if there was a "parallel" statement, that could simplify writing threadprocs. e.g. (theoretical c#) ...
10
2676
by: Ruben Hoste | last post by:
Hello, I'm currently looking for more information on Genetic Algorithms and more specifficaly on how to program them in Java or C++. This is all concerning my thesis. A lot of general information about GA's, what they are and how they generally work I already found on the web, but I'm looking for some more information on how to actually...
9
8424
by: MNQ | last post by:
Hi All I want to use my parallel port of my PC to control some external devices. I am writing a program in ANSI C using the PacificC compiler. What I need to know is how to access the parallel port ie to send data and to read the state of the parallel port including the control lines. Can anyone help/point me in the correct direction? I...
2
1980
by: Carlos Pezzotta | last post by:
Hi guys, I have to develop an application to capture the "printed" data from another machine. I have a specialized hardware (not a computer) that has only a parallel port (Centronics-SPP) connected to a printer. I think the only way to capture the information that the system send to printer is connecting a computer to this...
12
8605
by: david.brown.0 | last post by:
I'm trying to make a Java program access a parallel port. Java's comm API does not provide me with the control I need. I need to be able to write to the data and control pins and read the status pins. Any Java people know a good solution? I'm trying to use JNI and create my own library, but building the library gives me these errors: ...
4
15287
by: Soren | last post by:
Hi, I want to control some motors using the parallel port.. however, my laptop does not have any parallel ports (very few do). What I do have is a USB->Parallel converter... I thought about using PyParallel, but the USB->Parallel converter doesn't actually map to the LPT port .. and PyParallel only looks for LPT ports? Has anyone...
0
2114
by: faztech | last post by:
Hello, I appreciate if you guys can help me clarifying the proper setup for my proposed development project that may be using parallel to serial/usb converter. Please see this image before I explain further. 2410 Basically, what it does, the PC/server will tap the printing data from the legacy system. Since, parallel comm is not...
0
7410
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7668
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7923
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5984
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5343
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4960
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3466
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
722
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.