How to install plenv and Carton

plenv

Install

#install plenv
git clone https://github.com/tokuhirom/plenv.git ~/.plenv

echo 'export PATH="$HOME/.plenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(plenv init -)"' >> ~/.bashrc
exec $SHELL -l

#install perl-build
git clone https://github.com/tokuhirom/Perl-Build.git ~/.plenv/plugins/perl-build/

How to use plenv

#show the list of available perl(Display installable perl list)
plenv install --list

#install
plenv install 5.8.8

#check the installed perl
plenv versions

#designate using version of perl(global)
plenv global 5.8.8

#designate using version of perl(local)
plenv local 5.8.8

#exec this after installation(To enable installed Perl)
plenv rehash

#check the current version of perl
plenv version

#install cpanm to local
plenv install-cpanm
#if below error occur, modify install script.
#curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
vi .plenv/libexec/plenv-install-cpanm
>curl -Lk http://cpanmin.us/ | plenv exec perl - App::cpanminus #new


#check the path of cpanm
plenv which cpanm

#check the installed modules
plenv list-modules

How to migrate installed modules from system to plenv's perl by plenv

#module install from other version of perl
plenv migrate-modules ${from_version} ${to_version}
#ex)migrate modules from pre-installed perl to plenv's perl
plenv migrate-modules system 5.8.8

#check the installed modules
plenv list-modules

Carton

cpanm Carton
#make cpanfile in advance

#install modules(save to current_dir/local/)
carton install

#check cpanfile.snapshot(This file is made by carton install. When you execute bundle install, it's necessary)
ls cpanfile.snapshot

#copy tarball from local dir to vendor dir
carton bundle

#install by vendor dir as CPAN mirror
carton install --cached

#use modules of local directory
carton exec -- ${perl_script} ${arg1} ${arg2}

Make cpanfile(like Gemfile)

git clone https://gist.github.com/5883207.git make_cpanfile
cd make_cpanfile
perl installed2cpanfile > cpanfile

参考書籍: