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

How to restore @INC

by andreas1234567 (Vicar)
on Nov 18, 2008 at 08:30 UTC ( [id://724221]=perlquestion: print w/replies, xml ) Need Help??

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

I was testing a local build of perl, and in the process I seem to have altered the /usr/bin/perl library path:
$ which perl /usr/bin/perl $ perl -v This is perl, v5.8.8 built for x86_64-linux-thread-multi $ perl -V | tail -8 Compiled at Nov 6 2008 13:11:21 @INC: /lib/5.8.8/x86_64-linux-thread-multi /lib/5.8.8 /lib/site_perl/5.8.8/x86_64-linux-thread-multi /lib/site_perl/5.8.8 /lib/site_perl . $
How can I set @INC back to (taken from an identical system) this?
@INC: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 . $ uname -a Linux desktop 2.6.18-92.el5 #1 SMP Tue Jun 10 18:51:06 EDT 2008 x86_64 + x86_64 x86_64 GNU/Linux
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]

Replies are listed 'Best First'.
Re: How to restore @INC
by Corion (Patriarch) on Nov 18, 2008 at 08:40 UTC

    Basically, for pre-5.8.8 Perls, you have to either edit the perl binary and fix the hardcoded values or you have to recompile Perl.

    Supposedly, for younger Perls (5.10, 5.8.8+), Perl can set up @INC relative to itself even on operating systems where this was claimed to be impossible, such as all unixish operating systems.

    The easy way out would be to just set $ENV{PERL5LIB} to the entries you want in @INC or to recompile Perl with the appropriate installation path already set up.

      Thanks, I did not think of that. It turns out one could also do a reinstall of the perl binary:
      # rpm -e --nodeps perl # yum install perl
      No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]
Re: How to restore @INC
by petr999 (Acolyte) on Nov 19, 2008 at 13:53 UTC
    i think the everyone should like to see the tweak-ish config on this, just like we have at apache's Why not? Even in mod_perl i can vary @INC, in FCGI::ProcManager too. But not in the 'plain' perl.
    Yes, this is achievable by sources patch, but mission is possible. And, this may be the faster problem solution when the existing sysadmin setup is very custom. At least on FreeBSD i have choice on threads, GDBM, etc.

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-07-17 16:03 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.