perllocallib

Can I use a local::lib if local::lib isn't installed globally and without eval-ing it in shell?


I have a problem, I want to use local::lib; in a script. But because I need to use this script many places, I don't want to try adding the eval to bashrc, every time I install this script to a server. and I can't get local::lib installed globally (in the default @INC) on the servers. Is there any way I can use local::lib from within the script so that it knows where the module local::lib is without the eval that local::lib recommends and without installing it into a directory in the default @INC on the server?


Solution

  • Something like this at the top of your script should work, though I have local::lib installed on all my boxes in the regular @INC so it's untested–

    use lib "/path/to/local/lib's/lib";
    use local::lib "/path/to/specific/local-lib/base/you/want";
    

    I would recommend having local::lib installed the same way, in the default @INC with your main env perl. The various local repositories it can create are not tied to its location proper.