Path::FindDev(3)
okay so Path::FindDev(3) β User Contributed Perl Documentation, hi bestie π β is literally the package that finds a development path somewhere in an upper hierarchy. It's giving "where is my project root" but make it cute and automatic.
β¨ NAME β¨
Path::FindDev β find a development path somewhere in an upper hierarchy. That's the whole vibe. π
π VERSION π
version v0.5.3 β yes bestie, we're on that version, noted and slayed. π
π¦ DESCRIPTION π¦
This package is mostly a glue layer around Path::IsDev with a few directory walking tricks. That's it, that's the plot. Lowkey iconic.
use Path::FindDev qw( find_dev );
if ( my $root = find_dev('/some/path/to/something/somewhere')) {
print "development root = $root";
} else {
print "No development root :(";
}
Like, you hand it a path, it goes looking, and either you get your dev root or you get the sad little "No development root :(" message. No cap. π
π FUNCTIONS π
πΈ find_dev
my $result = find_dev('/some/path');
If a "dev" directory is found at, or above, "/some/path", it will be returned as a "Path::Tiny" β so you get a whole object back, not just a boring string, periodt. π«Ά
If you pass configurations to import:
use Path::FindDev find_dev => { set => $someset };
Then the exported "find_dev" will pass that set name to "Path::IsDev". Cute, right?
Though you should only do this if:
- the default set is inadequate for your usage
- you don't want the set to be overridden by
%ENV
Both valid reasons, bestie. Pick your fighter. π
Additionally, you can call find_dev directly:
require Path::FindDev;
my $result = Path::FindDev::find_dev('/some/path');
heads up: which by design inhibits your capacity to specify an alternative set in code. iykyk β that's the tradeoff, not a bug.
π₯ EXAMPLE USE-CASES π₯
Have you ever found yourself doing:
use FindBin;
use lib "$FindBin::Bin/../../../tlib"
In a test? Because same. π
Have you found yourself paranoid of file-system semantics and tried:
use FindBin;
use Path::Tiny qw(path)
use lib path($FindBin::Bin)->parent->parent->parent->child('tlib')->stringify;
Also valid paranoia, honestly. π
Have you ever done either of the above in a test, only to find you've needed to move the test to a deeper hierarchy, and thus, need to re-write all your path resolution? The absolute pain. π
Have you ever had this problem for multiple files? Not the multiple files, bestie. Anything but that.
No more! π
use FindBin;
use Path::FindDev qw(find_dev);
use lib find_dev($FindBin::Bin)->child('t','tlib')->stringify;
^ Should work, regardless of which test you put it in, and regardless of what $CWD happens to be when you call it. Slay. That's the whole point. π
πΊ AUTHOR πΊ
Kent Fredric <kentnl@cpan.org> β the main character who made this happen. π«Ά
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Free software rights, periodt. π
okay final sign-off bestie: this was Path::FindDev(3), delivered by perl v5.42.0 on 2017-03-11, and yes we kept every little detail because that's the whole assignment. mwah πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Path-FindDev 0.5.3-bp160.1.11 Β· Artistic-1.0 or GPL-1.0+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms