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

automatic/unattended cpan install

by raiten (Acolyte)
on Mar 15, 2007 at 21:25 UTC ( #605070=perlquestion: print w/replies, xml ) Need Help??
raiten has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to script install of perl modules. the simple way is

$ perl -MCPAN -e"install <Module>"
but that's not for me ... two reasons

- first, there are two type of modules. first build normally with <code> perl Makefile.PL PREFIX=xxx

Replies are listed 'Best First'.
Re: automatic/unattended cpan install
by qsl (Scribe) on Mar 16, 2007 at 03:44 UTC
    what is your question ?
      how install multiple perl modules in a non-standard place is the main problem. if possible, in a way, dependencies are handle the right way.

Re: automatic/unattended cpan install
by diotalevi (Canon) on Mar 19, 2007 at 04:49 UTC

    The easiest way to solve this problem is to create a CPAN::MyConfig file which has all the makepl_arg value set and also a ~/.modulebuildrc file.


    $CPAN::Config->{makepl_arg} = q[INSTALLARCHLIB=/home/.../.perl/lib INSTALLBIN=/home/.../bin INSTALLMAN1DIR=/home/.../.perl/man/man1 INSTALLMAN3DIR=/home/.../.perl/man/man3 INSTALLPRIVLIB=/home/.../.perl/lib INSTALLSCRIPT=/home/.../bin INSTALLSITEARCH=/home/.../.perl/lib INSTALLSITEBIN=/home/.../bin INSTALLSITELIB=/home/.../.perl/lib INSTALLSITEMAN1DIR=/home/.../.perl/man/man1 INSTALLSITEMAN3DIR=/home/.../.perl/man/man3 INSTALLVENDORARCH=/home/.../.perl/lib INSTALLVENDORBIN=/home/.../bin INSTALLVENDORLIB=/home/.../.perl/lib INSTALLVENDORMAN1DIR=/home/.../.perl/man/man1 INSTALLVENDORMAN3DIR=/home/.../.perl/man/man3];


    --installpath lib=/home/.../.perl/lib --installpath arch=/home/.../.perl/lib --installpath bin=/home/.../bin --installpath bindoc=/home/.../.perl/man/man1 --installpath libdoc=/home/.../.perl/man/man3

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      ok for .modulebuildrc, i missed this config file.

      works ok for direct install. fail if deps :(
      perl -MCPAN -e "install DateTime::TimeZone"

      why do we need to put all env/prefix ? with command line, 1 argument (PREFIX) is sufficient ... strange. can i use env variable or perl var to avoid repeating same path ? seems not:
      my $local_prefix = '/home/touche/.cpan/local'; $CPAN::Config->{makepl_arg} = q[INSTALLARCHLIB=$local_prefix/lib INSTA +LLBIN=$loc al_prefix/bin INSTALLMAN1DIR=$local_prefix/man/man1 INSTALLMAN3DIR=$lo +cal_prefix /man/man3 INSTALLPRIVLIB=$local_prefix/lib INSTALLSCRIPT=$local_prefix +/bin INSTA LLSITEARCH=$local_prefix/lib INSTALLSITEBIN=$local_prefix/bin INSTALLS +ITELIB=$lo cal_prefix/lib INSTALLSITEMAN1DIR=$local_prefix/man/man1 INSTALLSITEMA +N3DIR=$loc al_prefix/man/man3 INSTALLVENDORARCH=$local_prefix/lib INSTALLVENDORBI +N=$local_p refix/bin INSTALLVENDORLIB=$local_prefix/lib INSTALLVENDORMAN1DIR=$loc +al_prefix/ man/man1 INSTALLVENDORMAN3DIR=$local_prefix/man/man3];

      else do you know a way to launch install like 'perl -MCPAN -e "install xxx" -f -f modulebuildrc' ? or to force to accept/refuse deps (to be non-interactive) ? disable "make test" ? force install without dependancies check ?

      anyway thanks a lot :)
Re: automatic/unattended cpan install
by Anonymous Monk on Mar 16, 2007 at 08:21 UTC
    Do you know $HOME will be expanded?
      in make_arg or make_install_arg (with tee), it is expanded.
      i also test without env var and that's the same, it tries to install in default prefix.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://605070]
Approved by jettero
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2017-03-26 04:33 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (313 votes). Check out past polls.