Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to permanently change @INC

Status
Not open for further replies.

whn

Programmer
Oct 14, 2007
265
0
0
US
% 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!
 
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
 
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,
 
Hi

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

Feherke.
feherke.github.io
 
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 lib It seems to me @INC was changed after I installed lib Now I want to uninstall it but I don't know how. I'll certainly google it first.

Thanks again.
 
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 (Note: In the example below, the linux prompt is ' 62 => ')

[tt] 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/unlink /usr/local/man/man3/unlink /usr/local/share/perl/5.10.1/unlink /usr/local/share/perl/5.10.1/unlink /usr/local/lib/perl/5.10.1/auto/
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.[/tt]
=============================================
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 -
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top