How do I tell CPAN to install all dependencies?

后端 未结 10 983
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-30 16:27

How do I tell CPAN to install all dependencies?

I tried setting these in cpan:

cpan> o conf prerequisites_policy follow
cpan> o co         


        
相关标签:
10条回答
  • 2020-11-30 17:16

    Here is the one-liner making these changes permanent including automatic first-time CPAN configuration:

    perl -MCPAN -e 'my $c = "CPAN::HandleConfig"; $c->load(doit => 1, autoconfig => 1); $c->edit(prerequisites_policy => "follow"); $c->edit(build_requires_install_policy => "yes"); $c->commit'
    

    Or combine it with local::lib module for non-privileged users:

    perl -MCPAN -Mlocal::lib=~/perl5 -e 'my $c = "CPAN::HandleConfig"; $c->load(doit => 1, autoconfig => 1); $c->edit(prerequisites_policy => "follow"); $c->edit(build_requires_install_policy => "yes"); $c->commit'
    

    Run it before using the CPAN shell or whatever.

    0 讨论(0)
  • 2020-11-30 17:18

    Personally I have only tried a couple of times to modify the settings in that way and have actually found it easier to drop into the CPAN.pm shell by giving cpan no arguments, then configuring CPAN.pm from the interactive prompt:

    $ cpan
    cpan> o conf init
    

    This will initiate the CPAN.pm interfaces configuration utility. Simply run through it and specify "follow" where you need to (I forget the question offhand), and you should be good to go.

    0 讨论(0)
  • 2020-11-30 17:19

    The latest and greatest answer to this question is to use cpanm instead (also referred to as App::cpanminus or cpanminus)!

    DESCRIPTION

    cpanminus is a script to get, unpack, build and install modules from CPAN and does nothing else.

    It's dependency free (can bootstrap itself), requires zero configuration, and stands alone. When running, it requires only 10MB of RAM.

    To bootstrap install it:

    curl -L http://cpanmin.us | perl - --sudo App::cpanminus
    

    or if you are using perlbrew simply

    perlbrew install-cpanm
    

    or from cpan itself:

    cpan install App::cpanminus
    

    From then on install modules by executing (as root if necessary)

    cpanm Foo::Bar
    
    0 讨论(0)
  • 2020-11-30 17:20

    Here's what I'm pretty sure you're looking for:

    cpan> o conf prerequisites_policy follow
    cpan> o conf commit
    
    0 讨论(0)
提交回复
热议问题