Skip to content

Instantly share code, notes, and snippets.

@revmischa
Last active July 12, 2022 02:25
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save revmischa/7438068 to your computer and use it in GitHub Desktop.
Save revmischa/7438068 to your computer and use it in GitHub Desktop.
Set up plenv, install perl, cpanm, carton, set up environment
#!/bin/bash
# installs plenv, perl, carton, cpanminus, sets up environment in .bash_profile
# from https://github.com/tokuhirom/plenv#readme
PLENV_PERL_VERSION='5.18.1'
if [[ -n "$PERL_MB_OPT" ]]; then
echo "You must unset your local::lib environment variables first"
echo "Edit your ~/.bash_profile or ~/.bashrc and remove any references"
echo "to local::lib or export PERL*..."
exit 1
fi
echo " - Building perl environment -"
# get plenv latest
echo " + Cloning latest plenv..."
git clone git://github.com/tokuhirom/plenv.git ~/.plenv
echo " + Updating .bash_profile with plenv bin and perl binary shims..."
PLENV_PATH='export PATH="$HOME/.plenv/bin:$PATH"'
PLENV_INIT='eval "$(plenv init -)"'
echo $PLENV_PATH >> ~/.bash_profile # add plenv to path
echo $PLENV_INIT >> ~/.bash_profile # shims and autocomplete
# make the above available for the rest of this script
eval $PLENV_PATH
eval $PLENV_INIT
echo " + Cloning perl-build..."
git clone git://github.com/tokuhirom/Perl-Build.git ~/.plenv/plugins/perl-build/
echo " + Building perl ${PLENV_PERL_VERSION}..."
plenv install $PLENV_PERL_VERSION -Dusethreads
echo " + Switching to $PLENV_PERL_VERSION"
plenv local $PLENV_PERL_VERSION
echo " + Installing cpanminus..."
plenv install-cpanm
echo " + Installing carton..."
cpanm Carton
echo "plenv installation complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment