Subject: | and method |
Hi
I´m a great fan of File::Find::Rule. One thing i miss is a add method.
#!/usr/bin/perl
use strict;
use warnings;
use File::Find::Rule;
sub File::Find::Rule::and {
my $self = shift;
push @{ $self->{rules} }, {
rule => 'and',
code => '(' . join( ' && ', map {
"( " . $_->_compile( $self->{subs} ) . " )"
} @_ ) . ")",
args => \@_,
};
$self;
}
my @rules = (
File::Find::Rule->file,
File::Find::Rule->readable,
File::Find::Rule->size('<2M'),
);
my $find = File::Find::Rule->new;
$find->and(@rules)->start('/usr/local/bin');
while ( my $file = $find->match ) {
print $file, "\n";
}
regards
Christian Hansen