Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Location of perl libraries under unix

by richardX (Pilgrim)
on Jul 16, 2003 at 23:08 UTC ( [id://275064]=note: print w/replies, xml ) Need Help??


in reply to Location of perl libraries under unix

I use a hosted web site and they do not have CPAN modules installed. So I have to install them myself. Here is my workaround so far (an example):

perl -MCPAN -e 'install File::Spec'

cd /home/my_home_path/.cpan/build/File-Spec-0.82

perl Makefile.PL PREFIX=/home/my_home_path/.cpan/CPAN INSTALLDIRS=site INSTALLSITELIB=/home/my_home_path/.cpan/CPAN

make

make test

make install

I then add the following code to my Perl scripts:

BEGIN { unshift(@INC,"/home/my_home_path/.cpan/CPAN"); }

This BEGIN code at the beginning of the script allows me to not change the paths of all my modules.

Richard

There are three types of people in this world, those that can count and those that cannot. Anon

  • Comment on Re: Location of perl libraries under unix

Replies are listed 'Best First'.
Re: Re: Location of perl libraries under unix
by ajdelore (Pilgrim) on Jul 17, 2003 at 17:06 UTC

    Interesting solution... I suppose that installdirs=(site||perl) would dictate whether the installation goes into lib/perl/site_perl/5xxxx or lib/perl/5xxxx.

    I don't quite understand how my CGI works, as they have some kind of secure set-up. It uses a completely different server, and requires scripts to be permitted 700. I can't determine if it runs as me or if it runs as nobody, and if it runs as me it seems equivocal wether it picks up my PERLLIB environment or not.

    Of course, as soon as I write that I realize that I could write a cgi script to find that out rather quickly...

    What I have done in the past is create symlinks to the required modules from the CGI directory to my LIB directory, and this seems to work fine.

    Perhaps the BEGIN block would be more appropriate...

    </ajdelore>

Re: Re: Location of perl libraries under unix
by benizi (Hermit) on Jul 18, 2003 at 16:40 UTC
    According to 'perldoc lib':

    use lib LIST;

    is almost the same as saying:

    BEGIN { unshift(@INC, LIST) }

    The only difference is that, for each directory in the list, it checks for an architecture specific directory below. So, you've definitely hit on the right idea, but I think
    use lib '/home/my_home_path/.cpan/CPAN'; is a little cleaner.

    The other thing that might help is that you can configure CPAN to automate the exact sequence you describe. Run perl -MCPAN -e shell and do the following:

    o conf makepl_arg 'PREFIX=your_path_here INSTALLDIRS=site INSTALLSITELIB=your_path_here' (That's a lowercase 'o', not a bullet point)
    o conf on its own will show you your current conf(iguration) options.
    makepl_arg defines the options that will be passed after perl Makefile.PL

    Then, in the interactive shell, install File::Spec would be equivalent to the commands you listed above.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://275064]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-20 06:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found