NAME

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

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 as File::Find but works like an object and with an iterator. As File::Find is not object oriented, one cannot perform multiple searches in the same application. The second problem of File::Find is its file processing: after starting its main loop, one cannot easilly wait for another event an so get the next result.

With File::Find::Object you can get the next file by calling the next() function, but setting a callback is still possible.

FUNCTIONS

new

my $ffo = File::Find::Object->new( { options }, @targets);

Create a new File::Find::Object object. @targets is the list of directories or files which the object should explore.

options

depth

Boolean - returns the directory content before the directory itself.

nocrossfs

Boolean - doesn't continue on filesystems different than the parent.

Boolean - follow symlinks when they point to a directory.

You can safely set this option to true as File::Find::Object does not follow the link if it detects a loop.

filter

Function reference - should point to a function returning TRUE or FALSE. This function is called with the filename to filter, if the function return FALSE, the file is skipped.

callback

Function reference - should point to a function, which would be called each time a new file is returned. The function is called with the current filename as an argument.

next

Returns the next file found by the File::Find::Object. It returns undef once the scan is completed.

item

Returns the current filename found by the File::Find::Object object, i.e: the last value returned by next().

BUGS

Currently works only on UNIX as it uses '/' as a path separator.

SEE ALSO

File::Find