Making local::lib real easy to use
In bash, at least.
Just paste this (on your command line or into .bashrc
or wherever else you want):
perl-lib() { eval "`perl -M'local::lib @ARGV' - "$@" 0<&-`" ; }
Then you can just say things like this:
$ perl-lib ~/locallib/foo
$ perl-lib --deactivate ~/locallib/bar
$ perl-lib --deactivate-all
… instead of having to type stuff like this:
$ eval "`perl -Mlocal::lib - --deactivate ~/locallib/bar`"
… or even, as you would have had to in old versions of local::lib, this awfulness:
$ eval "`perl -Mlocal::lib=--deactivate,$HOME/locallib/bar`"
Note that the shell function will work irrespective of local::lib version.
Update: I originally posted this with a 1<&-
redirect in the function, which closes STDOUT. What I actually wanted to do was close STDIN, of course.
Leave a comment