Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Strange @INC behavior

by MistaMuShu (Beadle)
on Oct 17, 2004 at 19:10 UTC ( [id://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/ 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;'

      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/ 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/ line 16.
      BEGIN failed--compilation aborted at /usr/lib/perl/5.6.1/LWP/ line 16. Compilation failed in require at -e line 1.

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

        It should be 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?

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-06-12 21:38 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.