gbguccku has asked for the wisdom of the Perl Monks concerning the following question:
i have a script for a school project so the timeout i set 1 second and it stay alot of time i don't know why :(
use strict; use diagnostics; use warnings; use LWP::UserAgent; use HTTP::Request; use HTTP::Response; my $def = new LWP::UserAgent; my $hostsfile; my $host; my @hosts; my $userresp; my $url; my @checks = ("http://HOST:5555/server/test.php"); my $ua = LWP::UserAgent->new(agent => "School", env_proxy => 1, keep_a +live => 1,timeout => 1); print qq(Host File Name:\t); $hostsfile = <STDIN>; chomp($hostsfile); open(IN, $hostsfile) or die "$!"; @hosts = <IN>; chomp(@hosts); print qq(School A28A group B project\n); print qq(Output Saved To CGIVTI.log.\n\n); foreach $host (@hosts) { foreach (@checks) { $url = $_; $url =~ s/HOST/$host/; #$url = $_; print qq(:: Checking $url...\n); my $request = new HTTP::Request('GET', $url); my $response = $def->request($request); if ($response->is_success) { print $response->content; open(OUT, ">>CGIVTI.log"); print OUT $url; close OUT; } else { print qq(Not wOKING..\n\n); } } } <>
look the timeout is 1 second and it stays 3-4 mins or more . Please help me. Thanks Cox.
I put all the code
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hello i have a problem with timeout in my script
by kennethk (Abbot) on Mar 08, 2015 at 18:48 UTC | |
|
Re: Hello i have a problem with timeout in my script
by Happy-the-monk (Canon) on Mar 08, 2015 at 16:31 UTC | |
|
Re: Hello i have a problem with timeout in my script
by Anonymous Monk on Mar 08, 2015 at 23:27 UTC |