File::FindByRegex is a Perl wrapper for File::Find that finds a directory tree and runs some action for each file whose name matchs a regex.
SYNOPSYS
use File::FindByRegex;
$find = File::FindByRegex->new( {
-srcdir => ['C:tmpteradata-sql'],
-tardir => 'C:tmpteradata-sqldoc',
-find => {no_chdir => 1},
-callbacks =>
{
qr/.p(lmodt)$/oi, => &treat_pod,
qr/sql.+?.sql$/oi, => 'treat_pod',
qr/.html?$/oi, => &treat_html,
qr/.txt$/oi => &treat_txt,
qr/.(jpggifpngbmptiff)$/ => sub { &treat_graphic(@_) }
},
-ignore =>
[
qr/eg.+.sql$/oi, # *.sql in directory eg
qr/java/oi, # All files in java directory.
],
-excepts =>
[
qr/java.*?.html?$/oi # don't ignore *.html in java/
]
});
sub File::FindByRegex::treat_pod
{
my $this = shift;
...
}
sub File::FindByRegex::treat_html
{
my $this = shift;
...
}
sub File::FindByRegex::treat_txt
{
my $this = shift;
...
}
sub File::FindByRegex::treat_graphic
{
my $this = shift;
...
}
$find->travel_tree;