Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Strange @INC behavior

by MistaMuShu (Beadle)
on Oct 17, 2004 at 19:10 UTC ( #399949=perlquestion: print w/replies, xml ) Need Help??

MistaMuShu has asked for the wisdom of the Perl Monks concerning the following question:

Morning Fellow Monks,

I had an old laptop lying around and decided to install Debian Woody on it and have it periodically run some perl scripts. When I moved my scripts over, LWP wasn't installed, so I went through the usual process and though everything seems fine to me, perl refuses to acknowledge that LWP/UserAgent.pm is in my @INC (contains: /usr/local/lib/perl/5.6.1 /usr/local/share/perl/5.6.1. /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.6.1 ...)

Navigating around, I found that /usr/lib/perl/5.6.1/LWP/ exists and was populated with the correct files. Initially I thought perhaps it was screwed up permissions, but after changing it around, I still have nothing.

Please monks, help a frustrated user out. Sorry if it seems like such a simple question, but it just doesn't seem to make sense since I can clearly see that the files are where perl would look for them, yet the script doesn't work

Replies are listed 'Best First'.
Re: Strange @INC behavior
by hsinclai (Deacon) on Oct 17, 2004 at 19:43 UTC
    I found that /usr/lib/perl/5.6.1/LWP/ exists
    The LWP stuff seems to (usually??) be found somewhere below the /usr/lib/perl5/5.x.x/ directory .. and a couple of programs in /usr/bin/ or /usr/local/bin, depending.. it is, on my Linux and FreeBSD systems.

    Simply updating your LWP packages might fix things ... and also making sure your scripts do point to the right Perl on the new system (there isn't more than one is there?) ..
    which perl perl -v perl -e 'print $_ . $/ for @INC;'


    HTH
      I'm pretty sure that there's only one version of perl installed because I did some searches in other forums for the problem. Sorry I forgot to mention that in the initial post.
Re: Strange @INC behavior
by ysth (Canon) on Oct 17, 2004 at 21:48 UTC
    Can you show actual perl -V output? And try
    perl -we'$!=0; eval { require LWP::Simple }; print "$@\nError: $!\n"'
      the output is:

      Can't locate HTTP/Status.pm in @INC (@INC contains: /usr/local/lib/perl/5.6.1 /usr/local/share/perl/5.6.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.6.1 /usr/share/perl/5.6.1 /usr/local/lib/site_perl .) at /usr/lib/perl/5.6.1/LWP/Simple.pm line 16.
      BEGIN failed--compilation aborted at /usr/lib/perl/5.6.1/LWP/Simple.pm line 16. Compilation failed in require at -e line 1.

      That's really interesting that it found /usr/lib/perl/5.6.1/LWP/Simple.pm in this example, and failed because of lack of HTTP/Status.pm, but it still doesn't explain why it "Can't locate LWP/Useragent.pm" when I try to run my script. Is there something blatantly obvious I'm missing?

        It should be UserAgent.pm. Can you try the above snippet with LWP::UserAgent instead of LWP::Simple? And also show the output of the command: perl -V

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://399949]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2023-03-29 03:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (70 votes). Check out past polls.

    Notices?