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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modify @INC

Status
Not open for further replies.

Kirsle

Programmer
Jan 21, 2006
1,179
US
I'm running Fedora Core 5 Linux and am trying to install wxPerl. I got the RPM files from the wxPerl site and got it all installed, the only problem is that it installed it somewhere that isn't in Perl's default @INC.

It installed to
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/

My current @INC is:
Code:
  @INC:
    /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.3/i386-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/5.8.4
    /usr/lib/perl5/site_perl/5.8.3
    /usr/lib/perl5/site_perl
    /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.3/i386-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/5.8.4
    /usr/lib/perl5/vendor_perl/5.8.3
    /usr/lib/perl5/vendor_perl
    /usr/lib/perl5/5.8.8/i386-linux-thread-multi
    /usr/lib/perl5/5.8.8
    .

How would I edit @INC to add the path where Wx was installed to? (and not having to resort to a per-script basis)

Thanks in advance.

-------------
Cuvou.com | The NEW Kirsle.net
 
$INC[++]='path/to/whatever/';

is just a guess ;-)

Did you find out where it put it, the CPAN testers should be aware of this, if not, duty calls ...

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
hunt around on perldoc/google for PERLLIB or PERL5LIB. I believe that is the ENV perl uses internally for @INC, but I'm not sure.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Yep. Use the PERL5LIB environment variable. Changing the default @INC otherwise will require a recompile IIRC.
 
'use lib' would probably work but you'd have to add it to each script that's using that particular module

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Thats what he is trying to avoid Paul. But of course it would work.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
The env variables PERLLIB and PERL5LIB didn't exist. I created PERL5LIB:

Code:
[COLOR=blue][kirsle@localhost demo]$ env PERL5LIB=/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi perl demo.pl[/color]
[COLOR=red]Can't load '/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Wx/Wx.so' for module Wx: libwx_gtk2u_adv-2.6.so.0: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm line 230.
 at demo.pl line 23
Compilation failed in require at demo.pl line 23.
BEGIN failed--compilation aborted at demo.pl line 23.
Deep recursion on subroutine "Wx::AUTOLOAD" at /home/kirsle/My Documents/Linux Stuff/wxPerl/Wx-0.26/demo/../blib/lib/Wx.pm line 43.[/color]

...as opposed to not setting the env variable:

Code:
[COLOR=blue][kirsle@localhost demo]$ perl demo.pl[/color]
[COLOR=red]Can't locate loadable object for module Wx in @INC (@INC contains: /home/kirsle/My Documents/Linux Stuff/wxPerl/Wx-0.26/demo/../blib/arch /home/kirsle/My Documents/Linux Stuff/wxPerl/Wx-0.26/demo/../blib/lib /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-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/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-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/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at demo.pl line 23
Compilation failed in require at demo.pl line 23.
BEGIN failed--compilation aborted at demo.pl line 23.
Deep recursion on subroutine "Wx::AUTOLOAD" at /home/kirsle/My Documents/Linux Stuff/wxPerl/Wx-0.26/demo/../blib/lib/Wx.pm line 43.[/color]

Those were from running "Wx-0.26/demo/demo.pl" which used the blib to load Wx. If I move the demo to another folder in which the blib isn't available and run it, I simply get:

Code:
[COLOR=blue][kirsle@localhost demo]$ perl demo.pl[/color]
[COLOR=red]Can't locate Wx.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-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/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-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/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at demo.pl line 23.
BEGIN failed--compilation aborted at demo.pl line 23.[/color]

So... I can't seem to figure out how to get this to work.

-------------
Cuvou.com | The NEW Kirsle.net
 
I found thus information in the perlrun docs:

-f

Disable executing $Config{sitelib}/sitecustomize.pl at startup.

Perl can be built so that it by default will try to execute $Config{sitelib}/sitecustomize.pl at startup. This is a hook that allows the sysadmin to customize how perl behaves. It can for instance be used to add entries to the @INC array to make perl find modules in non-standard locations.



------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Thanks Kevin, I'll see what I can do with that. :)

-------------
Cuvou.com | The NEW Kirsle.net
 
Ah, it figures. In the last few weeks I've jumped around different Linux distros, and now I'm back on Fedora Core 5, same as I started with.

I had seen Wx-Perl in the YUM repositories before, and this time around I decided to try installing it through there. And it worked just fine.

Lesson learned: see if there's a YUM or APT distro of a program first, then look for RPMs or the like, and don't compile from source code until the first options don't work.

-------------
Cuvou.com | The NEW Kirsle.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top