Differences

This shows you the differences between two versions of the page.

Link to this comparison view

internal:perl:cpan [2008/10/26 09:55]
solar created
internal:perl:cpan [2013/11/03 03:21] (current)
solar update for new CPAN shell
Line 4: Line 4:
  
   mkdir ~/perl   mkdir ~/perl
 +  export PERL5OPT="​-I${HOME}/​perl/​lib/​perl5 -I${HOME}/​perl/​lib/​perl5/​site_perl"​
   cpan   cpan
  
 You may have to type ''​perl -MCPAN -e shell''​ instead of ''​cpan''​ on some systems other than [[http://​www.openwall.com/​Owl/​|Owl]]. You may have to type ''​perl -MCPAN -e shell''​ instead of ''​cpan''​ on some systems other than [[http://​www.openwall.com/​Owl/​|Owl]].
  
-In response to the appropriate prompt, enter ''​PREFIX=~/​perl''​.+In response to the appropriate prompt, enter ''​PREFIX=~/​perl''​. ​ ​Update:​ with recent versions of the CPAN shell, this prompt no longer appears by default. ​ To make it appear (along with lots of other prompts), answer ''​no''​ to ''​Would you like to configure as much as possible automatically?'' ​ Alternatively,​ exit the CPAN shell after initial configuration is done and edit ''​.cpan/​CPAN/​MyConfig.pm''​ to set: 
 + 
 +  '​makepl_arg'​ => q[PREFIX=~/​perl],​
  
 Once in the CPAN shell, type ''​install MODULE'',​ where MODULE is the name of the module to install. Once in the CPAN shell, type ''​install MODULE'',​ where MODULE is the name of the module to install.
Line 14: Line 17:
 In order for Perl scripts to use modules installed in this way, at least _one_ of the following must be true: In order for Perl scripts to use modules installed in this way, at least _one_ of the following must be true:
  
-1. ''​PERL5OPT''​ be set to imply the appropriate ''​-I...'' ​option ​to Perl.  You can add the following line to ''​~/​.bashrc'':​+1. ''​PERL5OPT''​ be set to imply the appropriate ''​-I...'' ​options ​to Perl.  You can add the following line to ''​~/​.bashrc'':​
  
-  export PERL5OPT="​-I${HOME}/​perl/​lib/​perl5/​site_perl"​+  export PERL5OPT="​-I${HOME}/​perl/​lib/​perl5 ​-I${HOME}/​perl/​lib/​perl5/​site_perl"​
  
 This should work great for scripts invoked manually while logged in. This should work great for scripts invoked manually while logged in.
  
-2. The appropriate ''​-I...'' ​option ​be passed to ''​perl''​ explicitly. ​ This may be done by editing the first line of Perl scripts to become:+2. The appropriate ''​-I...'' ​options ​be passed to ''​perl''​ explicitly. ​ This may be done by editing the first line of Perl scripts to become:
  
-  #​!/​usr/​bin/​perl -I/​home/​.../​perl/​lib/​perl5/​site_perl+  #​!/​usr/​bin/​perl ​-I/​home/​.../​perl/​lib/​perl5 ​-I/​home/​.../​perl/​lib/​perl5/​site_perl
  
 (also include any other options to ''​perl''​ that the script might have already been using). (also include any other options to ''​perl''​ that the script might have already been using).
Line 28: Line 31:
 3. A ''​use lib ...''​ directive may be added to the Perl scripts: 3. A ''​use lib ...''​ directive may be added to the Perl scripts:
  
-  use lib qw(/​home/​.../​perl/​lib/​perl5/​site_perl);​+  use lib qw(/​home/​.../​perl/​lib/​perl5 ​/​home/​.../​perl/​lib/​perl5/​site_perl);​
  
 Naturally, the last two options are only needed for CGIs where we couldn'​t have conveniently set ''​PERL5OPT''​. Naturally, the last two options are only needed for CGIs where we couldn'​t have conveniently set ''​PERL5OPT''​.
 +
 +====== How to build CPAN modules as non-root yet install them globally ======
 +
 +[[:​people/​grg|Grigoriy]] used the following approach:
 +
 +<​file>​
 +First I installed and tested the modules locally to ~grg/​installroot/​
 +by setting the following in ~/​.cpan/​CPAN/​MyConfig.pm :
 +
 +  '​make_arg'​ => q[INSTALLDIRS=vendor DESTDIR=/​home/​grg/​installroot],​
 +  '​make_install_arg'​ => q[INSTALLDIRS=vendor DESTDIR=/​home/​grg/​installroot],​
 +
 +   # only for XML::​Parser::​Expat:​
 +   # '​makepl_arg'​ => q[EXPATINCPATH=/​opt/​libexpat/​current/​include EXPATLIBPATH=/​opt/​libexpat/​current/​lib],​
 +
 +and running:
 +
 +  $ FTP_PASSIVE=1 PERL5LIB=/​home/​grg/​installroot/​usr/​lib/​perl5/​vendor_perl/​5.8.3 cpan
 +
 +Some modules are broken and cannot be compiled or installed automatically (or
 +it's CPAN's approach used to install modules that is broken), so I installed them
 +manually by unpacking the tarball, patching/​tuning and running:
 +
 +  $ PERL5LIB=/​home/​grg/​installroot/​usr/​lib/​perl5/​vendor_perl/​5.8.3 \
 +      perl Makefile.PL INSTALLDIRS=vendor DESTDIR=/​home/​grg/​installroot
 +
 +  $ PERL5LIB=/​home/​grg/​installroot/​usr/​lib/​perl5/​vendor_perl/​5.8.3 \
 +      make INSTALLDIRS=vendor DESTDIR=/​home/​grg/​installroot install
 +
 +Then I moved /​home/​grg/​installroot/​usr/​lib/​perl5/​vendor_perl/​
 +to /​usr/​lib/​perl5/​vendor_perl/​ as root.
 +</​file>​
internal/perl/cpan.1225011359.txt · Last modified: 2008/10/26 09:55 by solar
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate to DokuWiki Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki Powered by OpenVZ Powered by Openwall GNU/*/Linux