summaryrefslogtreecommitdiff
path: root/plugins/perl/perl.plugin.zsh
diff options
context:
space:
mode:
authorjamesrtnz <jamesrt@gmail.com>2025-01-24 08:24:43 +1300
committerGitHub <noreply@github.com>2025-01-23 20:24:43 +0100
commit9a0e22c184f4348b4bda4cd3de306d65eb541341 (patch)
tree0fb4d95e57a100fd5fc31ac6238125117a59acc6 /plugins/perl/perl.plugin.zsh
parent501f29f90c67bfb47506715c894e710c46ae3e0e (diff)
downloadzsh-9a0e22c184f4348b4bda4cd3de306d65eb541341.tar.gz
zsh-9a0e22c184f4348b4bda4cd3de306d65eb541341.tar.bz2
zsh-9a0e22c184f4348b4bda4cd3de306d65eb541341.zip
feat(perl): add `perlbrew` auto activation (#12814)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Diffstat (limited to 'plugins/perl/perl.plugin.zsh')
-rw-r--r--plugins/perl/perl.plugin.zsh9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/perl/perl.plugin.zsh b/plugins/perl/perl.plugin.zsh
index 678e88d97..137fa252a 100644
--- a/plugins/perl/perl.plugin.zsh
+++ b/plugins/perl/perl.plugin.zsh
@@ -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