and breathe out

richardc on 2002-07-26T13:17:01

The uploaded file
    File-Find-Rule-0.01.tar.gz
has entered CPAN as

  file: $CPAN/authors/id/R/RC/RCLAMP/File-Find-Rule-0.01.tar.gz
  size: 7885 byte
   md5: c5ae958e7c110d3e23e8679652a223f8

No action is required on your part

After almost a week of dicking with the docs to try and make them as clear as possible it's released.

Play with, break, enjoy.


Works for me

petdance on 2002-07-26T14:09:10

Thanks for doin' this, Richard. It's awfully handy to be able to have:
my $rules = File::Find::Rule->new->file->name( '*.html' );
$rules->or( $rules->new->directory->name('CVS')->prune->discard, $rules->new );
my @html = $rules->in( './' );
to find all the HTML files in my project.

Re:Works for me

richardc on 2002-07-26T14:39:55

Thanks, though I don't think that does quite what you mean.

What you've constructed is:

file && name( '*.html' ) && ( ( directory && name( 'CVS' ) && prune && discard ) || anything )

So it won't be pruning any CVS directories, as file && directory won't fire. The matching path is file && name( '*.html' ) && anything. This does give me an idea though, 0.02 will probably let you query which rules fired for a particular file, if there's a way to do it without impacting on performance too much.

What I imagine you want is:

my $rules = File::Find::Rule->new;
$rule->or( $rule->new->directory->name('CVS')->prune->discard,
           $rule->new->file->name('*.html') );

Or, since CVS directories don't typically have anything that's called *.html in them

$rules = rule( name => '*.html' );

would probably just do.