1File::Find::Object(3) User Contributed Perl DocumentationFile::Find::Object(3)
2
3
4

NAME

6       File::Find::Object - An object oriented File::Find replacement
7

VERSION

9       version v0.3.2
10

SYNOPSIS

12           use File::Find::Object;
13           my $tree = File::Find::Object->new({}, @targets);
14
15           while (my $r = $tree->next()) {
16               print $r ."\n";
17           }
18

DESCRIPTION

20       File::Find::Object does the same job as File::Find but works like an
21       object and with an iterator. As File::Find is not object oriented, one
22       cannot perform multiple searches in the same application. The second
23       problem of File::Find is its file processing: after starting its main
24       loop, one cannot easily wait for another event and so get the next
25       result.
26
27       With File::Find::Object you can get the next file by calling the next()
28       function, but setting a callback is still possible.
29

FUNCTIONS

31   new
32           my $ffo = File::Find::Object->new( { options }, @targets);
33
34       Create a new File::Find::Object object. @targets is the list of
35       directories or files which the object should explore.
36
37       options
38
39       depth
40           Boolean - returns the directory content before the directory
41           itself.
42
43       nocrossfs
44           Boolean - doesn't continue on filesystems different than the
45           parent.
46
47       followlink
48           Boolean - follow symlinks when they point to a directory.
49
50           You can safely set this option to true as File::Find::Object does
51           not follow the link if it detects a loop.
52
53       filter
54           Function reference - should point to a function returning TRUE or
55           FALSE. This function is called with the filename to filter, if the
56           function return FALSE, the file is skipped.
57
58       callback
59           Function reference - should point to a function, which would be
60           called each time a new file is returned. The function is called
61           with the current filename as an argument.
62
63   next
64       Returns the next file found by the File::Find::Object. It returns undef
65       once the scan is completed.
66
67   item
68       Returns the current filename found by the File::Find::Object object,
69       i.e: the last value returned by next().
70
71   next_obj
72       Like next() only returns the result as a convenient
73       File::Find::Object::Result object. "$ff->next()" is equivalent to
74       "$ff->next_obj()->path()".
75
76   item_obj
77       Like item() only returns the result as a convenient
78       File::Find::Object::Result object. "$ff->item()" is equivalent to
79       "$ff->item_obj()->path()".
80
81   $ff->set_traverse_to([@children])
82       Sets the children to traverse to from the current node. Useful for
83       pruning items to traverse.
84
85       Accepts a single array reference.
86
87       Example:
88
89           $ff->set_traverse_to([ grep { ! /\A\./ } @{ $ff->get_traverse_to }]);
90
91   $ff->prune()
92       Prunes the current directory. Equivalent to $ff->set_traverse_to([]).
93
94   [@children] = $ff->get_traverse_to()
95       Retrieves the children that will be traversed to. Returns a single
96       array reference.
97
98       (Example under "set_traverse_to").
99
100   [@files] = $ff->get_current_node_files_list()
101       Gets all the files that appear in the current directory. This value
102       remains constant for every node, even after traversal or calls to
103       "set_traverse_to()" and is useful to use as the basis of the argument
104       for "set_traverse_to()".
105
106       Returns a single array reference.
107

BUGS

109       No bugs are known, but it doesn't mean there aren't any.
110

SEE ALSO

112       There's an article about this module in the Perl Advent Calendar of
113       2006: <http://perladvent.pm.org/2006/2/>.
114
115       File::Find is the core module for traversing files in perl, which has
116       several limitations.
117
118       File::Next, File::Find::Iterator, File::Walker and the unmaintained
119       File::FTS are alternatives to this module.
120

LICENSE

122       Copyright (C) 2005, 2006 by Olivier Thauvin
123
124       This package is free software; you can redistribute it and/or modify it
125       under the following terms:
126
127       1. The GNU General Public License Version 2.0 -
128       http://www.opensource.org/licenses/gpl-license.php
129
130       2. The Artistic License Version 2.0 -
131       http://www.perlfoundation.org/legal/licenses/artistic-2_0.html
132
133       3. At your option - any later version of either or both of these
134       licenses.
135

AUTHOR

137       Shlomi Fish <shlomif@cpan.org>
138
140       This software is Copyright (c) 2000 by Olivier Thauvin and others.
141
142       This is free software, licensed under:
143
144         The Artistic License 2.0 (GPL Compatible)
145

BUGS

147       Please report any bugs or feature requests on the bugtracker website
148       http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Find-Object or by email
149       to bug-file-find-object@rt.cpan.org.
150
151       When submitting a bug or request, please include a test-file or a patch
152       to an existing test-file that illustrates the bug or desired feature.
153

SUPPORT

155   Perldoc
156       You can find documentation for this module with the perldoc command.
157
158         perldoc File::Find::Object
159
160   Websites
161       The following websites have more information about this module, and may
162       be of help to you. As always, in addition to those websites please use
163       your favorite search engine to discover more resources.
164
165       ·   MetaCPAN
166
167           A modern, open-source CPAN search engine, useful to view POD in
168           HTML format.
169
170           <http://metacpan.org/release/File-Find-Object>
171
172       ·   Search CPAN
173
174           The default CPAN search engine, useful to view POD in HTML format.
175
176           <http://search.cpan.org/dist/File-Find-Object>
177
178       ·   RT: CPAN's Bug Tracker
179
180           The RT ( Request Tracker ) website is the default bug/issue
181           tracking system for CPAN.
182
183           <https://rt.cpan.org/Public/Dist/Display.html?Name=File-Find-Object>
184
185       ·   AnnoCPAN
186
187           The AnnoCPAN is a website that allows community annotations of Perl
188           module documentation.
189
190           <http://annocpan.org/dist/File-Find-Object>
191
192       ·   CPAN Ratings
193
194           The CPAN Ratings is a website that allows community ratings and
195           reviews of Perl modules.
196
197           <http://cpanratings.perl.org/d/File-Find-Object>
198
199       ·   CPAN Forum
200
201           The CPAN Forum is a web forum for discussing Perl modules.
202
203           <http://cpanforum.com/dist/File-Find-Object>
204
205       ·   CPANTS
206
207           The CPANTS is a website that analyzes the Kwalitee ( code metrics )
208           of a distribution.
209
210           <http://cpants.cpanauthors.org/dist/File-Find-Object>
211
212       ·   CPAN Testers
213
214           The CPAN Testers is a network of smokers who run automated tests on
215           uploaded CPAN distributions.
216
217           <http://www.cpantesters.org/distro/F/File-Find-Object>
218
219       ·   CPAN Testers Matrix
220
221           The CPAN Testers Matrix is a website that provides a visual
222           overview of the test results for a distribution on various
223           Perls/platforms.
224
225           <http://matrix.cpantesters.org/?dist=File-Find-Object>
226
227       ·   CPAN Testers Dependencies
228
229           The CPAN Testers Dependencies is a website that shows a chart of
230           the test results of all dependencies for a distribution.
231
232           <http://deps.cpantesters.org/?module=File::Find::Object>
233
234   Bugs / Feature Requests
235       Please report any bugs or feature requests by email to
236       "bug-file-find-object at rt.cpan.org", or through the web interface at
237       <https://rt.cpan.org/Public/Bug/Report.html?Queue=File-Find-Object>.
238       You will be automatically notified of any progress on the request by
239       the system.
240
241   Source Code
242       The code is open to the world, and available for you to hack on. Please
243       feel free to browse it and play with it, or whatever. If you want to
244       contribute patches, please send me a diff or prod me to pull from your
245       repository :)
246
247       <http://bitbucket.org/shlomif/perl-file-find-object>
248
249         hg clone ssh://hg@bitbucket.org/shlomif/perl-file-find-object
250
251
252
253perl v5.28.1                      2017-01-13             File::Find::Object(3)
Impressum