Hi,
I am new to this stuff...so if anybody could explain why am getting this
error, i'll be thankful.
the following is the script where its trying to get a html page. when i run
this script by typing:
perl "filename" , then i get the following error.
Can't locate LWP/UserAgent.pm in @INC (@INC contains:
/usr/lib/perl5/5.6.0/i386-
linux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i386-linux
/usr/lib/pe
rl5/site_perl/5.6.0 /usr/lib/perl5/site_perl .) at getgoogle line 4.
BEGIN failed--compilation aborted at getgoogle line 4.
i installed the Bundle::LWP by typing :
"install Bundle::LWP" from the CPAN shell. but am still getting the above
error.
can anyone help me debug this problem ??
thanx
karthik
#!/usr/bin/perl
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("$0/0.1 " . $ua->agent);
$content = "hl=en&q=programmer";
$req = new HTTP::Request 'GET' =>
'http://www.google.com/search';
$req->header('Accept' => 'text/html');
$req->content($content);
# send request
$res = $ua->request($req);
# check the outcome
if ($res->is_success) {
print $res->content;
} else {
print "Error: " . $res->code . " " .
$res->message;
}