LWP:UserAgent not working ???

G

Gaurav

Hello,

i have a perl script that i last used early this year i guess. It was running fine.

Now if i try to run it, i get this error message.
***********************************
perl data.pl 4 1 2002 6 30 2002
Can't locate LWP/UserAgent.pm in @INC (@INC contains:
/usr/perl5/5.00503/sun4-so
laris /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris
/usr/perl5/site
_perl/5.005 .) at Web.pm line 12.
BEGIN failed--compilation aborted at data.pl line 10.
***********************************



File: data.pl
*****************************************************
#! /usr/local/bin/perl

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

#importing package Web
use Web; //LINE 10

-----
*************************************************


FILE: Web.pm
******************************************
package Web;

#LWP::UserAgent class implements WWW user agent in perl refer this website
#for more details , http://www.perldoc.com/perl5.6/lib/LWP/UserAgent.html
------
require LWP::UserAgent; //LINE 12
-------
*******************************************************


Can someone tell me whats wrong?
what is @INC ?

thank you in advance.

Gaurav
 
G

Gunnar Hjalmarsson

Gaurav said:
i have a perl script that i last used early this year i guess. It
was running fine.

Now if i try to run it, i get this error message.
***********************************
perl data.pl 4 1 2002 6 30 2002
Can't locate LWP/UserAgent.pm in @INC

Can someone tell me whats wrong?

I suppose that it is a CGI script that you are running on a shared
server somewhere, and that your hosting provider has made some changes
since last time you run it.

You should ask your provider to reinstall the libwww-perl package.
what is @INC ?

http://learn.perl.org/
 
B

Bill

Hello,

i have a perl script that i last used early this year i guess. It was running fine.

Was this on the samer server setup? Or was the installation changed?

Now if i try to run it, i get this error message.
***********************************
perl data.pl 4 1 2002 6 30 2002
Can't locate LWP/UserAgent.pm in @INC (@INC contains:
/usr/perl5/5.00503/sun4-so
laris /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris
/usr/perl5/site
_perl/5.005 .) at Web.pm line 12.
BEGIN failed--compilation aborted at data.pl line 10.
***********************************


Can someone tell me whats wrong?
what is @INC ?

@INC is the list of places where a module might be stored on disk.
thank you in advance.

Gaurav

Usually this means LWP is not installed properly--check this via

perl -e "use LWP::UserAgent;"

at the command line--does it tell you it cannot find the module?
 
G

Gaurav

Was this on the samer server setup? Or was the installation changed?



@INC is the list of places where a module might be stored on disk.


Usually this means LWP is not installed properly--check this via

perl -e "use LWP::UserAgent;"

at the command line--does it tell you it cannot find the module?


I tried perl -e "use LWP::UserAgent;" on my server and i got the
following message. It seems like module doesnt exist.
**********************************
gbansal@ernie:~> perl -e "use LWP::UserAgent;"
Can't locate LWP/UserAgent.pm in @INC (@INC contains:
/usr/perl5/5.00503/sun4-so
laris /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris
/usr/perl5/site
_perl/5.005 .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
***************************************

How can i add the module ? I am a user on a school server.

Gaurav
 
M

Michael Budash

(e-mail address removed) (Bill) wrote in message



I tried perl -e "use LWP::UserAgent;" on my server and i got the
following message. It seems like module doesnt exist.
**********************************
gbansal@ernie:~> perl -e "use LWP::UserAgent;"
Can't locate LWP/UserAgent.pm in @INC (@INC contains:
/usr/perl5/5.00503/sun4-so
laris /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris
/usr/perl5/site
_perl/5.005 .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
***************************************

How can i add the module ? I am a user on a school server.

Gaurav

perldoc -q "my own"
 
B

Bill

I tried perl -e "use LWP::UserAgent;" on my server and i got the
following message. It seems like module doesnt exist.
**********************************
gbansal@ernie:~> perl -e "use LWP::UserAgent;"
Can't locate LWP/UserAgent.pm in @INC (@INC contains:
/usr/perl5/5.00503/sun4-so
laris /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris
/usr/perl5/site
_perl/5.005 .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
***************************************

How can i add the module ? I am a user on a school server.

Gaurav

Simplest, have your sysadmin do it.

However, I've installed user directory CPAN modules via HTTP/CGI
before, so I know it's possible to install them yourself, as long as
you can create directories on your server somewhere.

See if you can run CPAN from the Command line:

$> perl -e "use CPAN; CPAN::shell(); "

If so, read the documentation for CPAN to set up installation to one
of your directories. Then add a
use INC 'mydir';

to your programs. The documentation for CPAN has this:

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

How do I manually install a module in a private/non-standard
directory?
You need to set PREFIX and LIB when you run the Makefile.PL. LIB is
where the module files will go and PREFIX is the stub directory for
everything else. For example:


foo@barbell$ perl Makefile.PL LIB=/home/foobar/mylib
PREFIX=/home/foobar/mylib
Read more about this in the ExtUtils::MakeMaker documentation.


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

How do I use a module installed in a private/non-standard directory?
There are several ways to use modules installed in private
directories:

foo@barbell$ setenv PERL5LIB /path/to/module sets the environment
variable PERL5LIB.
use lib qw(/path/to/module); used at the top of your script tells perl
where to find your module.
foo@barbell$ perl -I/path/to/module
All of these will append /path/to/module to @INC. You should keep in
mind that having private/non-standard libraries may cause problems if
you wish to have portable code.

----------------------------------------------
 
G

Gaurav

Simplest, have your sysadmin do it.

However, I've installed user directory CPAN modules via HTTP/CGI
before, so I know it's possible to install them yourself, as long as
you can create directories on your server somewhere.

See if you can run CPAN from the Command line:

$> perl -e "use CPAN; CPAN::shell(); "

If so, read the documentation for CPAN to set up installation to one
of your directories. Then add a
use INC 'mydir';

to your programs. The documentation for CPAN has this:

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

How do I manually install a module in a private/non-standard
directory?
You need to set PREFIX and LIB when you run the Makefile.PL. LIB is
where the module files will go and PREFIX is the stub directory for
everything else. For example:


foo@barbell$ perl Makefile.PL LIB=/home/foobar/mylib
PREFIX=/home/foobar/mylib
Read more about this in the ExtUtils::MakeMaker documentation.


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

How do I use a module installed in a private/non-standard directory?
There are several ways to use modules installed in private
directories:

foo@barbell$ setenv PERL5LIB /path/to/module sets the environment
variable PERL5LIB.
use lib qw(/path/to/module); used at the top of your script tells perl
where to find your module.
foo@barbell$ perl -I/path/to/module
All of these will append /path/to/module to @INC. You should keep in
mind that having private/non-standard libraries may cause problems if
you wish to have portable code.

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

where can i find just the module needed for LWP::UserAgent to work. Do
i need more modules or just that one particular module ?

thanx.
 
B

Bart Lateur

Gaurav said:
where can i find just the module needed for LWP::UserAgent to work. Do
i need more modules or just that one particular module ?

lib-www, that's the suite you need. I think it only relies on standard
modules.
 
G

Gaurav

Bart Lateur said:
lib-www, that's the suite you need. I think it only relies on standard
modules.

###################

I have tried running the script on my laptop having win 2000. I have
the latest cygwin installed and it comes with perl.

I am getting the same error message.

So everything we have discussed so far also applies to personal
computer with perl bundled in Cygwin ??

thank you .
Gaurav
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top