feat(perl): add perlbrew auto activation (#12814)

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
This commit is contained in:
jamesrtnz 2025-01-24 08:24:43 +13:00 committed by GitHub
commit 9a0e22c184
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 17 deletions

View file

@ -54,3 +54,12 @@ pgs() { # [find] [replace] [filename]
prep() { # [pattern] [filename unless STDOUT]
perl -nle 'print if /'"$1"'/;' $2
}
# If the 'perlbrew' function isn't defined, perlbrew isn't setup.
if [[ $ZSH_PERLBREW_ACTIVATE != false ]] && (( ! $+functions[perlbrew] )); then
local _perlbrew="${PERLBREW_ROOT:-${HOME}/perl5/perlbrew}"
if [[ -f "${_perlbrew}/etc/bashrc" ]]; then
source "${_perlbrew}/etc/bashrc"
fi
unset _perlbrew
fi