1File::Find::Rule::ProceUdsuerralC(o3n)tributed Perl DocuFmielnet:a:tFiionnd::Rule::Procedural(3)
2
3
4
6 File::Find::Rule::Procedural - File::Find::Rule's procedural interface
7
9 use File::Find::Rule;
10
11 # find all .pm files, procedurally
12 my @files = find(file => name => '*.pm', in => \@INC);
13
15 In addition to the regular object-oriented interface, File::Find::Rule
16 provides two subroutines for you to use.
17
18 "find( @clauses )"
19 "rule( @clauses )"
20 "find" and "rule" can be used to invoke any methods available to
21 the OO version. "rule" is a synonym for "find"
22
23 Passing more than one value to a clause is done with an anonymous
24 array:
25
26 my $finder = find( name => [ '*.mp3', '*.ogg' ] );
27
28 "find" and "rule" both return a File::Find::Rule instance, unless one
29 of the arguments is "in", in which case it returns a list of things
30 that match the rule.
31
32 my @files = find( name => [ '*.mp3', '*.ogg' ], in => $ENV{HOME} );
33
34 Please note that "in" will be the last clause evaluated, and so this
35 code will search for mp3s regardless of size.
36
37 my @files = find( name => '*.mp3', in => $ENV{HOME}, size => '<2k' );
38 ^
39 |
40 Clause processing stopped here ------/
41
42 It is also possible to invert a single rule by prefixing it with "!"
43 like so:
44
45 # large files that aren't videos
46 my @files = find( file =>
47 '!name' => [ '*.avi', '*.mov' ],
48 size => '>20M',
49 in => $ENV{HOME} );
50
52 Richard Clamp <richardc@unixbeard.net>
53
55 Copyright (C) 2003 Richard Clamp. All Rights Reserved.
56
57 This module is free software; you can redistribute it and/or modify it
58 under the same terms as Perl itself.
59
61 File::Find::Rule
62
63
64
65perl v5.30.0 2019-07-26 File::Find::Rule::Procedural(3)