1File::Find::Rule::Perl(U3s)er Contributed Perl DocumentatFiiolne::Find::Rule::Perl(3)
2
3
4
6 File::Find::Rule::Perl - Common rules for searching for Perl things
7
9 use File::Find::Rule ();
10 use File::Find::Rule::Perl ();
11
12 # Find all Perl files smaller than 10k
13 my @files = File::Find::Rule->perl_file
14 ->size('<10Ki')
15 ->in('dir');
16
17 # Locate all the modules that PAUSE will index
18 my @mod = File::Find::Rule->no_index
19 ->perl_module
20 ->in('My-Distribution');
21
23 I write a lot of things that muck with Perl files. And it always
24 annoyed me that finding "perl files" requires a moderately complex
25 File::Find::Rule pattern.
26
27 File::Find::Rule::Perl provides methods for finding various types Perl-
28 related files, or replicating search queries run on a distribution in
29 various parts of the CPAN ecosystem.
30
32 perl_module
33 The "perl_module" rule locates perl modules. That is, files that are
34 named "*.pm".
35
36 This rule is equivalent to "->"file->name( '*.pm' )> and is included
37 primarily for completeness.
38
39 perl_test
40 The "perl_test" rule locates perl test scripts. That is, files that are
41 named "*.t".
42
43 This rule is equivalent to "->"file->name( '*.t' )> and is included
44 primarily for completeness.
45
46 perl_installer
47 The "perl_installer" rule locates perl distribution installers. That
48 is, it locates "Makefile.PL" and "Build.PL" files.
49
50 perl_script
51 The "perl_script" rule locates perl scripts.
52
53 This is any file that ends in .pl, or any files without extensions that
54 have a perl "hash-bang" line.
55
56 perl_file
57 The "perl_file" rule locates all files containing Perl code.
58
59 This includes all the files matching the above "perl_module",
60 "perl_test", "perl_installer" and "perl_script" rules.
61
62 no_index
63 # Provide the rules directly
64 $rule->no_index(
65 directory => [ 'inc', 't', 'examples' ],
66 file => [ 'Foo.pm', 'lib/Foo.pm' ],
67 );
68
69 # Provide a META.yml to use
70 $rule->no_index( 'META.yml' );
71
72 # Provide a dist root directory to look for a META.yml in
73 $rule->no_index( 'My-Distribution' );
74
75 # Automatically pick up a META.yml from the target directory
76 $rule->no_index->in( 'My-Distribution' );
77
78 The "no_index" method applies a set of rules as per the no_index
79 section in a "META.yml" file.
80
82 Bugs should always be submitted via the CPAN bug tracker
83
84 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-Find-Rule-Perl>
85
86 For other issues, contact the maintainer
87
89 Adam Kennedy <adamk@cpan.org>
90
92 <http://ali.as/>, File::Find::Rule, File::Find::Rule::PPI
93
95 Copyright 2006 - 2012 Adam Kennedy.
96
97 This program is free software; you can redistribute it and/or modify it
98 under the same terms as Perl itself.
99
100 The full text of the license can be found in the LICENSE file included
101 with this module.
102
103
104
105perl v5.34.0 2021-07-22 File::Find::Rule::Perl(3)