2

我按照这个问题投票最多的答案中的说明如何将 CPAN 模块安装到本地目录中?,这基本上说我可以配置 CPAN 以在本地安装模块:

% cpan
cpan> o conf makepl_arg INSTALL_BASE=/mydir/perl
cpan> o conf commit

cpan> o conf mbuild_arg '--install_base /mydir/perl'
cpan> o conf commit

但是,当我尝试

% cpan
% install List::Gen

我的安装失败(看起来 CPAN 仍然尝试在系统路径上安装)。为什么?

cpan[4]> install List::Gen
Going to read '/home/XXXX/.cpan/Metadata'
  Database was generated on Mon, 04 Feb 2013 18:41:02 GMT
Running install for module 'List::Gen'
Running make for A/AS/ASG/List-Gen-0.974.tar.gz
Checksum for /home/XXXX/.cpan/sources/authors/id/A/AS/ASG/List-Gen-0.974
.tar.gz ok                                                                 
Scanning cache /home/XXXX/.cpan/build for sizes
............................................................................
DONE                                                                       
/bin/tar: Read 9216 bytes from -

  CPAN.pm: Going to build A/AS/ASG/List-Gen-0.974.tar.gz

Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'List-Gen' version '0.974'
Building List-Gen
  ASG/List-Gen-0.974.tar.gz
  ./Build --install_base /mydir/perl --install_base /mydir/perl -- OK                                                              
Running Build test
t/00-load.t ............... 1/1 # Testing List::Gen 0.974, Perl 5.014001, /SOME_SYSTEM_PATH/perl-5.14.1-x86_64/bin/perl        
t/00-load.t ............... ok   
t/01-load.t ............... ok   
t/02-load.t ............... ok   
t/03-load.t ............... ok   
t/04-load.t ............... ok   
t/05-load.t ............... ok   
t/06-load.t ............... ok   
t/listgen.t ............... ok         
t/listgen_builtins.t ...... ok   
t/listgen_lazy.t .......... ok     
t/listgen_lazy_haskell.t .. ok       
t/listgen_ops.t ........... ok     
t/listgen_perl6.t ......... ok     
t/listgenerator.t ......... ok       
t/pod-coverage.t .......... skipped: Test::Pod::Coverage 1.08 required for t
esting POD coverage                                                        
t/pod.t ................... ok   
t/threads.t ............... skipped: threads not yet supported in perl 5.13+
All tests successful.
Files=17, Tests=1614,  6 wallclock secs ( 0.20 usr  0.11 sys +  3.12 cusr  0
.60 csys =  4.03 CPU)                                                      
Result: PASS
  ASG/List-Gen-0.974.tar.gz
  ./Build test -- OK
Running Build install
Building List-Gen
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Can't create '/SOME_SYSTEM_PATH/perl-5.14.1-x86_64/lib/site_perl/5.14.1/List'
mkdir /SOME_SYSTEM_PATH/perl-5.14.1-x86_64/lib/site_perl/5.14.1/List: Permission denied a
t /SOME_SYSTEM_PATH/perl-5.14.1-x86_64/lib/5.14.1/ExtUtils/Install.pm line 494.         

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 at /SOME_SYSTEM_PATH/perl-5.14.1-x86_64/lib/site_perl/5.14.1/Module/Build/Base.pm line 3
581.                                                                       
  ASG/List-Gen-0.974.tar.gz
  ./Build install  -- NOT OK
Failed during this command:
 ASG/List-Gen-0.974.tar.gz                    : install NO
4

1 回答 1

2

应该是mbuildpl_arg,不是mbuild_arg

o conf mbuild_arg ''                              # Fix past error
o conf mbuildpl_arg '--install_base /mydir/perl'  # Specify install base
o conf commit                                     # Save changes
于 2013-02-05T02:12:00.470 回答