Solved

perl lwp question on windows

Posted on 2004-08-29
2
287 Views
Last Modified: 2010-03-05
Hello,

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("http://www.oreilly.com/");
print $response->header("Server"), "\n";


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

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

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

Could it be a path problem perhaps?

Thanks!




0
Comment
Question by:pennypiper
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 11928291
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?
0
 

Author Comment

by:pennypiper
ID: 11928317
That's it!  I had indeed misspelled UserAgent.  Thank-you!
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Syslog text file into database or into .CSV 19 142
perl match and sort unique result 2 136
Perl, group, sort, count question 6 133
Add additional column to .csv using Perl. 8 141
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question