[Qatar-pm] LWP Question

Kosala Atapattu kosala.atapattu at gmail.com
Mon Jun 1 20:53:19 PDT 2009


Hi Guys/Gals,

I have a problem with LWP::Simple. As you may aware, LWP::Simple does
not provide a simpler way to impose connection or read timeout for the
request. But after little bit googling
(http://www.perlmonks.org/?node_id=168684) I found that, there is a
workaround to export LWP::UserAgent object from the LWP::Simple.

sub check_http {
       my ($url, $match) = @_;
       use LWP::Simple qw($ua get);
       $ua->timeout (20);
       my $content = get ($url) or return 0;
       return 1 if ($content =~ /$match/);
       return 0;
}

But the this code is not working, or giving unexpected results, any idea why?

-- 
Kosala
--------------------------------------------
Disclaimer: Views expressed in this mail are my personal views and
they would not reflect views of the employer.
--------------------------------------------
blog.kosala.net
www.linux.lk/~kosala/
www.kosala.net


More information about the Qatar-pm mailing list