2012-01-31 23:37:51 -05:00
|
|
|
#
|
|
|
|
# Enables local Perl module installation on Mac OS X and defines aliases.
|
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
#
|
|
|
|
|
2012-07-23 15:00:44 -04:00
|
|
|
# Return if requirements are not found.
|
|
|
|
if (( ! $+commands[perl] )); then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2012-08-04 14:48:32 -04:00
|
|
|
#
|
|
|
|
# Local Module Installation
|
|
|
|
#
|
|
|
|
|
2011-08-28 15:29:56 -04:00
|
|
|
if [[ "$OSTYPE" == darwin* ]]; then
|
|
|
|
# Perl is slow; cache its output.
|
|
|
|
cache_file="${0:h}/cache.zsh"
|
|
|
|
perl_path="$HOME/Library/Perl/5.12"
|
2012-07-03 21:35:49 -04:00
|
|
|
|
2011-08-28 15:29:56 -04:00
|
|
|
if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then
|
2011-12-28 16:13:08 -05:00
|
|
|
manpath=("$perl_path/man" $manpath)
|
2012-07-03 21:35:49 -04:00
|
|
|
|
2012-04-16 14:21:29 -04:00
|
|
|
if [[ ! -s "$cache_file" ]]; then
|
2011-08-28 15:29:56 -04:00
|
|
|
perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file"
|
|
|
|
fi
|
2012-07-03 21:35:49 -04:00
|
|
|
|
|
|
|
source "$cache_file"
|
2011-08-28 15:29:56 -04:00
|
|
|
fi
|
2012-07-03 21:35:49 -04:00
|
|
|
|
2011-08-28 15:29:56 -04:00
|
|
|
unset perl_path
|
|
|
|
unset cache_file
|
|
|
|
|
2011-12-28 16:13:08 -05:00
|
|
|
# Set environment variables for launchd processes.
|
2011-08-28 15:29:56 -04:00
|
|
|
for env_var in PERL_LOCAL_LIB_ROOT PERL_MB_OPT PERL_MM_OPT PERL5LIB; do
|
|
|
|
launchctl setenv "$env_var" "${(P)env_var}" &!
|
|
|
|
done
|
|
|
|
unset env_var
|
|
|
|
fi
|
|
|
|
|
2012-08-04 14:48:32 -04:00
|
|
|
#
|
2011-08-28 15:28:09 -04:00
|
|
|
# Aliases
|
2012-08-04 14:48:32 -04:00
|
|
|
#
|
2012-06-12 19:16:59 -04:00
|
|
|
|
|
|
|
# General
|
2012-08-13 20:05:30 -04:00
|
|
|
alias pl='perl'
|
|
|
|
alias pld='perldoc'
|
|
|
|
alias ple='perl -wlne'
|
2012-06-12 19:16:59 -04:00
|
|
|
|
|
|
|
# Perlbrew
|
2012-08-13 20:05:30 -04:00
|
|
|
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'
|
2011-03-14 01:43:33 -04:00
|
|
|
|