×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

how to permanently change @INC

how to permanently change @INC

how to permanently change @INC

(OP)
% perl -V
......
......
@INC:
/etc/perl
/usr/local/lib/perl/5.10.1
/usr/local/share/perl/5.10.1
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.10
/usr/share/perl/5.10
/usr/local/lib/site_perl
.

Is there a way I can recompile perl so that /usr/share/perl/5.10 is before /usr/local/lib/perl/5.10.1?

many thanks!

RE: how to permanently change @INC

Hi

If the modification will produce no size change, I would try to edit the executable itself. Personally I would use MCEdit. And a backup, of course.

Feherke.
feherke.github.io

RE: how to permanently change @INC

(OP)
Hi Feherke,

thanks for your response. But could you please show me how to do it step by step? I googled mcedit and have no idea how mcedit is related to modify @INC.

I just want to permanently change the order in @INC, so that it will pick up 5.10 first instead of 5.10.1.

Thanks,

RE: how to permanently change @INC

Hi

Just edit it :
  • in the command line :
    • create a backup : cp /usr/bin/perl ~/backup/perl
    • open /usr/bin/perl : mcedit /usr/bin/perl
  • in MCEdit :
    • search for the path : F7, type "/usr/share/perl/5.10", Enter
    • select it : F3, move you cursor to select "/usr/share/perl/5.10^@", F3
    • move the cursor before /usr/local/lib/perl/5.10.1
    • move the selection there : F6
    • double check that the ^@ separators between paths are balanced
    • save : F2
    • exit : F10
This works for me.

Feherke.
feherke.github.io

RE: how to permanently change @INC

(OP)
Thank you, Feherke.

I just installed mcedit. But, unfortunately, it cannot find that path. As an experiment, I also tried to search for libperl. It finds libperl.so.5.10\@. But when I tried to find libperl.so.5.10, it could not find anything.

I guess I'll to find some different way to change @INC.

BTW, do you happen to know how to uninstall a CPAN module.

The problem I having now could be caused by my installation of libwww-perl-6.05. It seems to me @INC was changed after I installed libwww-perl-6.05. Now I want to uninstall it but I don't know how. I'll certainly google it first.

Thanks again.

RE: how to permanently change @INC

Hi

Quote (whn)

BTW, do you happen to know how to uninstall a CPAN module.
Sorry, no. ( Actually the CPAN package manager already scared me on installation, so I avoided it. )

Feherke.
feherke.github.io

RE: how to permanently change @INC

(OP)
I did some search and found something that may help me. But I have some questions about them.

Method I: make uninstall

So I did an experiment to try uninstall a module called WWW-RobotRules-6.02:
(Note: In the example below, the linux prompt is 'WWW-RobotRules-6.02 62 => ')

WWW-RobotRules-6.02 62 => make uninstall
=============================================
Uninstall is unsafe and deprecated, the uninstallation was not performed.
We will show what would have been done.

unlink /usr/local/man/man3/WWW::RobotRules.3pm
unlink /usr/local/man/man3/WWW::RobotRules::AnyDBM_File.3pm
unlink /usr/local/share/perl/5.10.1/WWW/RobotRules.pm
unlink /usr/local/share/perl/5.10.1/WWW/RobotRules/AnyDBM_File.pm
unlink /usr/local/lib/perl/5.10.1/auto/WWW/RobotRules/.packlist

Uninstall is unsafe and deprecated, the uninstallation was not performed.
Please check the list above carefully, there may be errors.
Remove the appropriate files manually.
Sorry for the inconvenience.

=============================================
It prints out the commands which are handy to run manually. But apparently it does not modify @INC. I guess it should be OK?

Method II: to use pm-uninstall module found at meta::cpan site - https://metacpan.org/module/pm-uninstall

I downloaded the pkg and unpacked it. All files are listed below:

App-pmuninstall-0.30 151 => ls -l
total 64
drwxr-xr-x 2 chyan staff 4096 2013-07-23 11:40 bin/
-rw-r--r-- 1 chyan staff 1824 2013-06-03 10:42 Build.PL
-rw-r--r-- 1 chyan staff 3022 2013-06-03 10:42 Changes
-rw-r--r-- 1 chyan staff 293 2013-06-03 10:42 cpanfile
drwxr-xr-x 3 chyan staff 4096 2013-07-23 11:35 lib/
-rw-r--r-- 1 chyan staff 18346 2013-06-03 10:42 LICENSE
-rw-r--r-- 1 chyan staff 179 2013-06-03 10:42 MANIFEST
-rw-r--r-- 1 chyan staff 2080 2013-06-03 10:42 META.json
-rw-r--r-- 1 chyan staff 1111 2013-06-03 10:42 META.yml
-rw-r--r-- 1 chyan staff 25 2013-06-03 10:42 minil.toml
-rw-r--r-- 1 chyan staff 1420 2013-06-03 10:42 README.md
drwxr-xr-x 2 chyan staff 4096 2013-07-23 11:35 t/
drwxr-xr-x 2 chyan staff 4096 2013-07-23 11:35 xt/

I only know one way to install a non-core cpan module by using Makefile.PL:
Step 1: perl Makefile.PL [return]
Step 2: make [return]
Step 3: sudo make install [return]

But this module (pm-uninstall] has a file Build.PL. Could someone kindly show me how to install this module? The README.MD file is merely a cmdline interface help menu.

many thanks.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close