]> git.sev.monster Git - dotfiles.git/blobdiff - etc/zsh/.zshenv
zlogout: clean up logic, dont act without data
[dotfiles.git] / etc / zsh / .zshenv
index 29f59e7375f8dc28af7b9fc1f866ba88f154d568..37daf7fc58bceecc1c5f8c4dcf3cd918d9a53e40 100644 (file)
@@ -294,17 +294,32 @@ if [[ ! -v GNUPGHOME ]] {
 }
 
 ## perl local lib
-[[ ! -v PERL_LOCAL_LIB_ROOT && -v commands[perl] &&
-   -d ${XDG_DATA_HOME:-~/.local/share}/perl5/lib/perl5 ]] &&
-  eval $(perl -I${XDG_DATA_HOME:-~/.local/share}/perl5/lib/perl5 \
-              -Mlocal::lib=${XDG_DATA_HOME:-~/.local/share}/perl5 2>/dev/null)
-
+if [[ ! -v PERL_LOCAL_LIB_ROOT && -v commands[perl] ]] {
+    _p5=${XDG_DATA_HOME:-~/.local/share}/perl5
+    [[ -d $_p5 ]] || mkdir -p $_p5
+    if [[ -f $_p5/lib/perl5/local/lib.pm ]] {
+        eval $(perl -I$_p5/lib/perl5 -Mlocal::lib=$_p5 2>/dev/null)
+    } else {
+        # emulate local::lib if not installed
+        path=($_p5/bin "${path[@]}")
+        export \
+          PERL_MB_OPT="--install_base '$_p5'" \
+          PERL_MM_OPT=INSTALL_BASE=$_p5 \
+          PERL5LIB=$_p5/lib/perl5 \
+          PERL_LOCAL_LIB_ROOT=$_p5${PERL_LOCAL_LIB_ROOT:+:$PERL_LOCAL_LIB_ROOT}
+    }
+    unset _p5
+}
 ## go
 if [[ -v commands[go] ]] {
     [[ ! -v GOPATH ]] && export GOPATH=${XDG_DATA_HOME:-~/.local/share}/go:~/go
     [[ ! -v GOBIN  ]] && export GOBIN=~/.local/bin
 }
 
+### plugins
+autoload -Uz load-plugins
+load-plugins zshenv
+
 ### load zshenv site-specific
 autoload -Uz load-site-dotfile
 load-site-dotfile zshenv
This page took 0.029641 seconds and 4 git commands to generate.