Discussion:
HTTP-Request-Common not working
Steve
2003-03-13 03:23:31 UTC
Permalink
I'm having a problem getting HTTP-Request-Common to work, so I made a test file with the code right out of the docs (well, different URL):

use HTTP::Request::Common;
$ua = LWP::UserAgent->new;
$ua->request(GET 'http://www.cnn.com/');

When I run this I get: Can't locate object method "new" via package "LWP::UserAgent" (perhaps you forgot to load "LWP::UserAgent"?) at test.pl line 2.

I could swear I have used this same code before without problems. What am I doing wrong?

Thanks....

Steve
Sisyphus
2003-03-13 03:35:21 UTC
Permalink
----- Original Message -----
From: "Steve" <***@cox.net>

use HTTP::Request::Common;
$ua = LWP::UserAgent->new;
$ua->request(GET 'http://www.cnn.com/');

When I run this I get: Can't locate object method "new" via package
"LWP::UserAgent" (perhaps you forgot to load "LWP::UserAgent"?) at test.pl
line 2.

-----------------------------------------

You need to 'use LWP::UserAgent;'
That's what the error message is trying to tell you.

Cheers,
Rob

Continue reading on narkive:
Loading...