2012-02-01 04:37:51 +00:00
|
|
|
#
|
2018-04-16 22:51:57 +00:00
|
|
|
# Enables local Perl module installation on macOS and defines aliases.
|
2012-02-01 04:37:51 +00:00
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
#
|
|
|
|
|
2012-07-23 19:00:44 +00:00
|
|
|
# Return if requirements are not found.
|
|
|
|
if (( ! $+commands[perl] )); then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2020-03-29 19:49:35 +00:00
|
|
|
# Load dependencies.
|
|
|
|
pmodload 'helper'
|
|
|
|
|
2017-04-18 08:57:35 +00:00
|
|
|
#
|
|
|
|
# Load Perlbrew or plenv
|
|
|
|
#
|
|
|
|
|
|
|
|
# Load Perlbrew into the shell session.
|
|
|
|
if [[ -s "${PERLBREW_ROOT:-$HOME/perl5/perlbrew}/etc/bashrc" ]]; then
|
|
|
|
source "${PERLBREW_ROOT:-$HOME/perl5/perlbrew}/etc/bashrc"
|
|
|
|
|
|
|
|
# Load Perlbrew completion.
|
|
|
|
if [[ -s "${PERLBREW_ROOT:-$HOME/perl5/perlbrew}/etc/perlbrew-completion.bash" ]]; then
|
|
|
|
source "${PERLBREW_ROOT:-$HOME/perl5/perlbrew}/etc/perlbrew-completion.bash"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Load manually installed plenv into the shell session.
|
|
|
|
elif [[ -s "$HOME/.plenv/bin/plenv" ]]; then
|
|
|
|
path=("$HOME/.plenv/bin" $path)
|
|
|
|
eval "$(plenv init - --no-rehash zsh)"
|
|
|
|
|
|
|
|
# Load package manager installed plenv into the shell session.
|
|
|
|
elif (( $+commands[plenv] )); then
|
|
|
|
eval "$(plenv init - --no-rehash zsh)"
|
|
|
|
fi
|
|
|
|
|
2012-08-04 18:48:32 +00:00
|
|
|
#
|
|
|
|
# Local Module Installation
|
|
|
|
#
|
|
|
|
|
2020-02-13 08:56:29 +00:00
|
|
|
if is-darwin; then
|
2011-08-28 19:29:56 +00:00
|
|
|
# Perl is slow; cache its output.
|
2020-06-04 20:53:44 +00:00
|
|
|
cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/perl-cache.zsh"
|
2011-08-28 19:29:56 +00:00
|
|
|
perl_path="$HOME/Library/Perl/5.12"
|
2012-07-04 01:35:49 +00:00
|
|
|
|
2011-08-28 19:29:56 +00:00
|
|
|
if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then
|
2018-05-06 20:19:35 +00:00
|
|
|
if [[ "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" || ! -s "$cache_file" ]]; then
|
2020-06-04 20:53:44 +00:00
|
|
|
mkdir -p "$cache_file:h"
|
2011-08-28 19:29:56 +00:00
|
|
|
perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file"
|
|
|
|
fi
|
2012-07-04 01:35:49 +00:00
|
|
|
|
|
|
|
source "$cache_file"
|
2011-08-28 19:29:56 +00:00
|
|
|
fi
|
2012-07-04 01:35:49 +00:00
|
|
|
|
2017-08-04 17:54:19 +00:00
|
|
|
unset cache_file perl_path
|
2011-08-28 19:29:56 +00:00
|
|
|
fi
|
|
|
|
|
2012-08-04 18:48:32 +00:00
|
|
|
#
|
2011-08-28 19:28:09 +00:00
|
|
|
# Aliases
|
2012-08-04 18:48:32 +00:00
|
|
|
#
|
2012-06-12 23:16:59 +00:00
|
|
|
|
|
|
|
# General
|
2012-08-14 00:05:30 +00:00
|
|
|
alias pl='perl'
|
|
|
|
alias pld='perldoc'
|
|
|
|
alias ple='perl -wlne'
|
2012-06-12 23:16:59 +00:00
|
|
|
|
|
|
|
# Perlbrew
|
2017-04-18 08:57:35 +00:00
|
|
|
if (( $+commands[perlbrew] )); then
|
|
|
|
alias plb='perlbrew'
|
|
|
|
alias plba='perlbrew available'
|
|
|
|
alias plbi='perlbrew install'
|
|
|
|
alias plbl='perlbrew list'
|
|
|
|
alias plbo='perlbrew off'
|
|
|
|
alias plbO='perlbrew switch-off'
|
|
|
|
alias plbs='perlbrew switch'
|
|
|
|
alias plbu='perlbrew use'
|
|
|
|
alias plbx='perlbrew uninstall'
|
|
|
|
|
|
|
|
elif (( $+commands[plenv] )); then
|
|
|
|
alias plv='plenv'
|
|
|
|
alias plvc='plenv commands'
|
|
|
|
alias plvl='plenv local'
|
|
|
|
alias plvg='plenv global'
|
|
|
|
alias plvs='plenv shell'
|
|
|
|
alias plvi='plenv install'
|
|
|
|
alias plvu='plenv uninstall'
|
|
|
|
alias plvr='plenv rehash'
|
|
|
|
alias plvv='plenv version'
|
|
|
|
alias plvV='plenv versions'
|
|
|
|
alias plvw='plenv which'
|
|
|
|
alias plvW='plenv whence'
|
|
|
|
alias plvm='plenv list-modules'
|
|
|
|
alias plvM='plenv migrate-modules'
|
|
|
|
alias plvI='plenv install-cpanm'
|
|
|
|
fi
|