Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Where to unpack CPAN modules

by throop (Chaplain)
on Dec 14, 2006 at 23:03 UTC ( #589929=perlquestion: print w/replies, xml ) Need Help??

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

Brethern

For those of us without root permissions, where shoud we unpack the CPAN modules?

I've got a directory, where I keep my Perl; it's ~/perl. I unzipped a bunch of CPAN modules into it; each created its own directory. Inside each of those directories, I ran the 'make'. Module-Dependency is typical: In ~/perl/Module-Dependency-1.86 I have a bunch of scripts that came with the distribution (plus a few more I built) a lib/ directory (with the original distribution) and a blib/lib directory (with copies created by the make, etc.)

When I direct Module::Dependency to run on its own codebase (sure, why not?) I get lots of warnings. Starting at ~/perl/Module-Dependency-1.86 it runs down both lib and blib/lib. It finds duplicates of every file and scolds me.

This makes me think that I have chosen my directory structure unfortuneately. Is this a usual enough place to unzip my files and to make them? Or is there a more standard and convenient choice?

throop

Replies are listed 'Best First'.
Re: Where to unpack CPAN modules
by Joost (Canon) on Dec 14, 2006 at 23:22 UTC

      I recommend using a combination of PREFIX= and LIB= as in:

      perl Makefile.PL PREFIX=~/perl LIB=~/perl/lib make make test make install

      If you have any modules that use Module::Build, the mantra is different: (presented here for completeness)

      perl Build.PL install_base=~/perl ./Build ./Build test ./Build install

      --

      Oh Lord, won’t you burn me a Knoppix CD ?
      My friends all rate Windows, I must disagree.
      Your powers of persuasion will set them all free,
      So oh Lord, won’t you burn me a Knoppix CD ?
      (Missquoting Janis Joplin)

Re: Where to unpack CPAN modules
by shmem (Chancellor) on Dec 15, 2006 at 01:26 UTC
    Addendum to Joost's advice: set your PERL5LIB environment variable to ~/somewhere so perl can find the installed modules. See perlrun.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re: Where to unpack CPAN modules
by rinceWind (Monsignor) on Dec 15, 2006 at 12:31 UTC

    I think that you need to keep your build directory tree separate from your installation directory tree.

    Untar your kits into ~/build rather than ~/perl, and remember to point PERL5LIB at ~/perl/lib, and you should be fine.

    --

    Oh Lord, won’t you burn me a Knoppix CD ?
    My friends all rate Windows, I must disagree.
    Your powers of persuasion will set them all free,
    So oh Lord, won’t you burn me a Knoppix CD ?
    (Missquoting Janis Joplin)

Re: Where to unpack CPAN modules
by leocharre (Priest) on Dec 15, 2006 at 15:38 UTC

    I'm going to assume that you have a hosting account on a *ix box with shell access. Log in, do ls -la and you may see a dir called '.cpan' (this should be in your account home directory).

    You want a file in '.cpan/CPAN/MyConfig.pm'

    Here's mine:

    $CPAN::Config = { 'build_cache' => q[10], 'build_dir' => q[/home/myself/.cpan/build], 'cache_metadata' => q[0], 'cpan_home' => q[/home/myself/.cpan], 'dontload_hash' => { }, 'ftp' => q[/usr/bin/ftp], 'ftp_proxy' => q[], 'getcwd' => q[cwd], 'gpg' => q[], 'gzip' => q[/usr/bin/gzip], 'histfile' => q[/home/myself/.cpan/histfile], 'histsize' => q[100], 'http_proxy' => q[], 'inactivity_timeout' => q[0], 'index_expire' => q[1], 'inhibit_startup_message' => q[0], 'keep_source_where' => q[/home/myself/.cpan/sources], 'lynx' => q[/usr/local/bin/lynx], 'make' => q[/usr/bin/make], 'make_arg' => q[], 'make_install_arg' => q[], 'makepl_arg' => q[PREFIX=/home/myself LIB=/home/myself/lib], 'ncftp' => q[], 'ncftpget' => q[], 'no_proxy' => q[], 'pager' => q[more], 'prerequisites_policy' => q[ask], 'scan_cache' => q[atstart], 'shell' => q[/bin/bash], 'tar' => q[/usr/bin/tar], 'term_is_latin' => q[1], 'unzip' => q[], 'urllist' => [q[ftp://mirrors.phenominet.com/pub/CPAN/], q[ftp://mir +rors.jtlnet.com/CPAN/], q[ftp://mirrors.24-7-solutions.net/pub/CPAN/] +, q[ftp://mirror.sit.wisc.edu/pub/CPAN/]], 'wget' => q[/usr/local/bin/wget], }; 1;

    With this all in place.. you can just run cpan to install modules! Woohoo!! cpan install The::Module::I::Want

Re: Where to unpack CPAN modules
by nicholasrperez (Monk) on Dec 15, 2006 at 17:40 UTC
    Sounds like you want your own development environment. I recommend compiling your own perl for that and giving it a prefix for installation. Personally I have everything in ~/installed/ with my path including ~/installed/bin. This lets me install perl cleanly and use it without disruption to the rest of the system (Debian makes heavy use of perl). Then when I run the cpan shell it pulls all its location stuff from Config.pm which conveniently points everything to ~/installed/. Inside of ~/installed, I keep a cpan directory and let CPAN use that as it's scratch space. All in all, it works well.
      Second that. I recently google-project-hosted a collection of bash scripts that I use to automate setting up my own local perl environment wherever I want.

      Pedantically thorough one-shot catalyst sandbox installation, soon it will automagically set up demo apps too...

      This is optimized for catalyst development, but if you edit install.sh and remove all the stuff related to catalyst, you should have an easy way to set up perl, update CPAN, add Module::Build. And maybe the tactics I use in terms of overly thorough backup of my environment, with easy aliases to help you on your way, could be of use as well.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://589929]
Approved by Joost
Front-paged by andyford
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2020-10-21 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (223 votes). Check out past polls.

    Notices?