1Path::FindDev(3) User Contributed Perl Documentation Path::FindDev(3)
2
3
4
6 Path::FindDev - Find a development path somewhere in an upper
7 hierarchy.
8
10 version v0.5.3
11
13 This package is mostly a glue layer around "Path::IsDev" with a few
14 directory walking tricks.
15
16 use Path::FindDev qw( find_dev );
17
18 if ( my $root = find_dev('/some/path/to/something/somewhere')) {
19 print "development root = $root";
20 } else {
21 print "No development root :(";
22 }
23
25 find_dev
26 my $result = find_dev('/some/path');
27
28 If a "dev" directory is found at, or above, "/some/path", it will be
29 returned as a "Path::Tiny"
30
31 If you pass configurations to import:
32
33 use Path::FindDev find_dev => { set => $someset };
34
35 Then the exported "find_dev" will pass that set name to "Path::IsDev".
36
37 Though you should only do this if
38
39 · the default set is inadequate for your usage
40
41 · you don't want the set to be overridden by %ENV
42
43 Additionally, you can call find_dev directly:
44
45 require Path::FindDev;
46
47 my $result = Path::FindDev::find_dev('/some/path');
48
49 Which by design inhibits your capacity to specify an alternative set in
50 code.
51
53 Have you ever found yourself doing
54
55 use FindBin;
56 use lib "$FindBin::Bin/../../../tlib"
57
58 In a test?
59
60 Have you found yourself paranoid of file-system semantics and tried
61
62 use FindBin;
63 use Path::Tiny qw(path)
64 use lib path($FindBin::Bin)->parent->parent->parent->child('tlib')->stringify;
65
66 Have you ever done either of the above in a test, only to find you've
67 needed to move the test to a deeper hierarchy, and thus, need to re-
68 write all your path resolution?
69
70 Have you ever had this problem for multiple files?
71
72 No more!
73
74 use FindBin;
75 use Path::FindDev qw(find_dev);
76 use lib find_dev($FindBin::Bin)->child('t','tlib')->stringify;
77
78 ^ Should work, regardless of which test you put it in, and regardless
79 of what $CWD happens to be when you call it.
80
82 Kent Fredric <kentnl@cpan.org>
83
85 This software is copyright (c) 2017 by Kent Fredric
86 <kentfredric@gmail.com>.
87
88 This is free software; you can redistribute it and/or modify it under
89 the same terms as the Perl 5 programming language system itself.
90
91
92
93perl v5.30.1 2020-01-30 Path::FindDev(3)