Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 303
  • Last Modified:

perl lwp question on windows


I've just installed ActivePerl on a windows 2000 machine.  When I run "c:\perl -v" it returns v5.8.4.  If I run "c:\perl -MLWP -le "print(LWP->VERSION)" it returns 5.79.  And when I run "c:\perl -MURI -le "print $URI::VERSION" it returns 1.30.

However, when I run the following program:

use Strict;
use warnings;

use LWP;

my $browser = LWP::UserAgent->new();
my $response = $browser->get("");
print $response->header("Server"), "\n";

(from the book "Perl & LWP") I receive the following error:

"c:\perl -w"
Can't locate object method "new" via package "LWP::userAgent" (perhaps you forgot to load "LWP::userAgent"?) at line 7

If I change the code to "use LWP::UserAgent;"   I still get the same error.

Could it be a path problem perhaps?


1 Solution
You say your code is
my $browser = LWP::UserAgent->new();
with a capital "U"
Yet the error message says "LWP::userAgent"
with a lower case "u"
Did you spell "UserAgent" correctly?
pennypiperAuthor Commented:
That's it!  I had indeed misspelled UserAgent.  Thank-you!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now