| 1 |
File::Finder - nice wrapper for File::Find ala find(1) |
| 2 |
|
| 3 |
SYNOPSIS |
| 4 |
|
| 5 |
use File::Finder; |
| 6 |
## simulate "-type f" |
| 7 |
my $all_files = File::Finder->type('f'); |
| 8 |
|
| 9 |
## any rule can be extended: |
| 10 |
my $all_files_printer = $all_files->print; |
| 11 |
|
| 12 |
## traditional use: generating "wanted" subroutines: |
| 13 |
use File::Find; |
| 14 |
find($all_files_printer, @starting_points); |
| 15 |
|
| 16 |
## or, we can gather up the results immediately: |
| 17 |
my @results = $all_files->in(@starting_points); |
| 18 |
|
| 19 |
## -depth and -follow are noted, but need a bit of help for find: |
| 20 |
my $deep_dirs = File::Finder->depth->type('d')->ls->exec('rmdir','{}'); |
| 21 |
find($deep_dirs->as_options, @places); |
| 22 |
|
| 23 |
DESCRIPTION |
| 24 |
|
| 25 |
File::Find is great, but constructing the wanted routine can |
| 26 |
sometimes be a pain. This module provides a wanted-writer, using |
| 27 |
syntax that is directly mappable to the find command's syntax. |
| 28 |
|
| 29 |
Also, I find myself (heh) frequently just wanting the list of names |
| 30 |
that match. With File::Find, I have to write a little accumulator, |
| 31 |
and then access that from a closure. But with File::Finder, I can |
| 32 |
turn the problem inside out. |
| 33 |
|