jlongino has asked for the wisdom of the Perl Monks concerning the following question:
As you can see I'm not really interested in any returned content, I just want to automate several button clicks (each URL is an action performed by a button press) and see that no error was encountered.use strict; require LWP::UserAgent; my $ua = LWP::UserAgent->new (env_proxy => 1, keep_alive => 1, timeout => 30); while(<DATA>) { chomp; my $req = HTTP::Request->new('GET', $_); my $resp = $ua->request($req); if ($resp->is_success) { # print $resp->content; print "OK -----> '", $_, "'\n"; } else { print "FAILED -> '" ,$_, "'\n"; } select((select(STDOUT), $| = 1)[0]); #flush STDOUT buffer } print "Finished.\n" __DATA__ http://www.thehungersite.com/cgi-bin/WebObjects/CTDSites.woa/60/wo/SJ5 +0004g800Ig400Xz/0.0.33.13.0.1.0.0.0.CustomContentActiveImageDisplayCo +mponent.0.0.0 http://www.thebreastcancersite.com/cgi-bin/WebObjects/CTDSites.woa/60/ +wo/SJ50004g800Ig400Xz/2.0.33.13.0.1.0.1.0.CustomContentActiveImageDis +playComponent.0.0.0 http://www.therainforestsite.com/cgi-bin/WebObjects/CTDSites.woa/60/wo +/SJ50004g800Ig400Xz/5.0.33.13.0.1.0.0.0.CustomContentActiveImageDispl +ayComponent.0.0.0 http://www.ecologyfund.com/registry/ecology/03_donate.html?noheader=-1 http://www.ecologyfund.com/registry/ecology/donate_pol.html?noheader=- +1 http://www.ecologyfund.com/registry/ecology/05_donate.html?noheader=-1 http://www.ecologyfund.com/registry/ecology/07_donate.html?noheader=-1 http://www.ecologyfund.com/registry/ecology/04_donate.html?noheader=-1 http://www.ecologyfund.com/registry/ecology/01_donate.html?noheader=-1 http://www.ecologyfund.com/registry/ecology/08_donate.html?noheader=-1 http://www.ecologyfund.com/registry/ecology/02_donate.html?noheader=-1
Some questions:
--Jim
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: Simple requests using LWP::UserAgent
by jeffa (Bishop) on Dec 06, 2001 at 00:00 UTC | |
|
(ar0n) Re: Simple requests using LWP::UserAgent
by ar0n (Priest) on Dec 06, 2001 at 00:32 UTC | |
|
Re: Simple requests using LWP::UserAgent
by blakem (Monsignor) on Dec 06, 2001 at 01:24 UTC | |
|
Re: STDOUT flush, Was: Simple requests using LWP::UserAgent
by baku (Scribe) on Dec 06, 2001 at 02:32 UTC |