Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LWP:: simple error

Status
Not open for further replies.

jackz15

Programmer
Jun 28, 2006
103
US
I 'm trying to install LWP::simple from cpan,
which i did by installing CPAN first then i typed
install LWP:simple
which installed it for me. So i tried to run this code:
#! /usr/bin/perl -w
use strict;
use LWP::simple;
my $content=get(' die "Couldn't get it!" unless defined $content;
which out puts this error:
#! /usr/bin/perl -w
use strict;
use LWP::simple;
my $content=get(' die "Couldn't get it!" unless defined $content;

why is this?
 
oops srry no its not,
the error something like this:
Undefined subroutine &main::get called at E:\lwp.pl line 4.
sorry i was in a rush so i didn't check that my copying didn't copy right...
 
Check that /usr/bin/perl is the path to where your perl modules are kept.

My system needs me to state /usr/perl/site/lib because of the way i installed it..

Maybe this may change something...

Although perhaps Kirsle would know better!!
 
I glanced back at your code and discovered a minor problem:

use LWP::simple;

Module names are case sensitive. Try this instead:

use LWP::Simple;

with a capital S on "Simple". I've had a problem like this with Mime::Lite when it was supposed to be spelled MIME::Lite. Perl didn't complain about a missing module when I used it, but I couldn't use any MIME::Lite functions because it wasn't loaded properly.
 
hey that helped!
I'm not too familar with the internals of perl, so this may be a stupid question:
all this time i've been using:
/usr/bin/perl -w
and calling "use" always worked for me for things like use DBI and such, did i install my modules in two different places?
 
i'm using windows and so the path to usr/bin/perl should be C:\perl\lib right? cause i don't see anything else. In c:\perl\site\lib\ is where i store my other modules. Is this supposed to happen? If not do i just need to merge the two directories?
 
Don't worry too much about the shebang line (the #!/usr/bin/perl) if you're on Windows. It's a Linux thing.

On Linux, that line tells Linux the location of the Perl interpreter so that it can execute the script. Windows knows it's a Perl script because of the PL extension, so it doesn't need this line.

So on Windows you can put modules in C:\perl\lib and C:\perl\site\lib
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top