in reply to use lib "."
I'm a bit surprised that nobody has so far mentioned FindBin, a core module, which is intended to solve your problem.
For your case, you can simply do:
use FindBin; use lib $FindBin::Bin;
The nice thing about FindBin is that as long as the directory structure of your code is constant, you can run scripts from wherever the directory tree exists. So it will work just as well from your local Git checkout, on the Jenkins server or the production location, which may well all be different.
A more typical directory structure would have a bin directory for scripts and lib for modules, so in that case the code would instead look like:
use FindBin; use lib "$FindBin::Bin/../lib";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: use lib "."
by kcott (Archbishop) on Aug 12, 2023 at 16:42 UTC | |
by philipbailey (Curate) on Aug 12, 2023 at 16:49 UTC | |
Re^2: use lib "."
by ikegami (Patriarch) on Aug 14, 2023 at 17:10 UTC | |
Re^2: use lib "."
by Bod (Parson) on Aug 12, 2023 at 19:06 UTC |