cpan ignores makepl_arg and mbuild_arg

2020-07-27 04:25发布

问题:

I followed the instructions in the most voted answer to this question How can I install a CPAN module into a local directory?, which basically says that I can configure CPAN to install modules locally with:

% 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

However, when I try

% cpan
% install List::Gen

My installation fails (it looks like CPAN still tries to install on a system path). Why?

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

回答1:

That should be mbuildpl_arg, not 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


标签: perl cpan