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