First release of lib::projectroot
I've just uploaded lib::projectroot 1.000 to CPAN. (formerly known as File::LoadLocalLib)
lib::projectroot
makes it easier to load all the project-specific, non-CPAN code ("DarkPAN") in your project's scripts.
For an example, assume you have a script somewhere deep down in your project tree (for example, bin/admin/fixups/realign_flux_compensator.pl
). Add this to the top of your script:
use lib::projectroot qw(lib local::lib=local);
lib::projectroot->load_extra(Your-OtherModule Dark-PAN);
lib::projectroot
will find the root of your project by walking up the from the directory the script is located, until it finds a directory containing the dirs lib
and local
. lib
will be added to @INC
, and local
will be loaded via local::lib
.
load_extra
will then walk up another directory (i.e. to the one containing your project) and look for dirs there named Your-OtherModule
and Dark-PAN
. If those dirs themselves contain a dir called lib
, those lib-dirs will be also added to @INC
.
This makes sense if you have a lot of local code packed into CPAN-like dists but not published on CPAN or managed via thinks like CPAN::Mini::Inject or Pinto
Of course you will need to install lib::projectroot
into your proper Perl (System Perl or the perlbrew). You cannot install it via local::lib
, if you want to use the local::lib
features...
Here's my first draft as published on prepan.org, and the github repo
Thanks to eserte
, Smylers
& abraxxa
for providing feedback at
prepan; and to koki
,
farhad
and Jozef
for providing face-to-face feedback.