Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
when I am using the below scripts I am getting error msg.
use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $ua->agent("MyApp/0.1 "); my $req = HTTP::Request->new(POST => 'http://search.cpan.org/search'); $req->content_type('application/x-www-form-urlencoded'); $req->content('query=libwww-perl&mode=dist'); my $res = $ua->request($req); if ($res->is_success) { print $res->content; } else { print $res->status_line, "\n"; }
Error Msg:
Can't call method "agent" on an undefined value at de.pl line 5.
I copied the "LWP::UserAgent" module then I don't know why..
Kindly help in this regard
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Error Msg of LWP::UserAgent
by PodMaster (Abbot) on Feb 24, 2005 at 05:20 UTC | |
|
Re: Error Msg of LWP::UserAgent
by ikegami (Patriarch) on Feb 24, 2005 at 05:28 UTC |