File::Find - Get a lazy list of a directory tree
my @list := find(dir => 'foo');
my $list = find(dir => 'foo');
File::Find allows you to get the contents of the given directory,
recursively. The only exported function, find() , generates a lazy
list of files in given directory. Every element of the list is a
File::Find::Result object, described below.
find() takes one (or more) named arguments. The dir argument
is mandatory, and sets the directory find() will traverse.
There are also few optional arguments. If more than one is passed,
all of them must match for a file to be returned.
Specify a name of the file File::Find is ought to look for. If you
pass a string here, find() will return only the files with the given
name. When passing a regex, only the files with path matching the
pattern will be returned.
Given a type, find() will only return files being the given type.
The available types are file , dir or symlink .
File::Find::Result object acts like a normal string, having two
additional accessors, dir and name , holding the directory
the file is in and the filename respectively.
Perl 5's File::Find
Please note, that this module is not trying to be the verbatim port of
Perl 5's File::Find module. Its interface is closer to Perl 5's
File::Find::Rule, and its features are planned to be similar one day.
List assignment is eager in Perl 6, so if You assign find() result
to an array, the elements will be copied and the laziness will be
spoiled. For a proper lazy list, use either binding ( := ) or assign
a result to a scalar value (see SYNOPSIS).