NAME
File::Find::Object - A File::Find object oriented
SYNOPSIS
use File::Find::Object;
my $tree = File::Find::Object->new({}, @dir);
while (my $r = $tree->next()) {
print $r ."\n";
}
DESCRIPTION
File::Find::Object does same job the File::Find but instead this one, works like an object and with an iterator. As File::Find is not object oriented you can't perform multiple search in same application. The second problem of File::Find is its file processing, after starting its main loop, you can't easilly wait another event an so get next result.
With File::Find::Object you get next file by calling next() functions, but setting a callback is still possible.
FUNCTIONS
new
my $ffo = File::Find::Object->new( { options }, @files);
Create a new File::Find::Object object. @files is the list of directory - or files - the object should explore.
options
- depth
-
Boolean, return the directory content before the directory itself
- nocrossfs
-
Boolean, don't continue on filesystem different than the parent
- followlink
-
Boolean, follow symlink when they point to a directory.
You can safelly set this options, File::Find::Object does not follow the link if detect a loop.
- filter
-
Function, should point to a function returning TRUE or FALSE. This function is call with the filename to filter, if the function return FALSE, the file is skiped.
- callback
-
Function, should point to a function calle each time a new file is return. The function is called with the current filename as argument.
next
Return the next file find by the File::Find::Object, it return undef at end.
item
Return the current filename found by the File::Find::Object object, aka the latest value return by next().
BUGS
Currently works only on UNIX as it use '/' as separator.