Date: | Mon, 4 Aug 2003 07:57:18 +0100 |
From: | Richard Clamp <richardc [...] unixbeard.net> |
To: | bug-file-find-rule [...] rt.cpan.org |
Subject: | [mschilli1@aol.com: File::Find::Rule doesn't like prune() and or()] |
--
Richard Clamp <richardc@unixbeard.net>
Return-Path: <Mschilli1@aol.com>
X-Original-To: richardc@unixbeard.net
Delivered-To: richardc@mirth.demon.co.uk
Received: from imo-d04.mx.aol.com (imo-d04.mx.aol.com [205.188.157.36])
by mirth.demon.co.uk (Postfix) with ESMTP id 35CFC33D0B
for <richardc@unixbeard.net>; Mon, 4 Aug 2003 07:42:12 +0100 (BST)
Received: from Mschilli1@aol.com
by imo-d04.mx.aol.com (mail_out_v36_r1.1.) id t.a9.4586f149 (16110)
for <richardc@unixbeard.net>; Mon, 4 Aug 2003 02:42:09 -0400 (EDT)
Received: from aol.com (mow-d18.webmail.aol.com [205.188.139.134]) by air-id12.mx.aol.com (v95.12) with ESMTP id MAILINID122-3eee3f2e00411c6; Mon, 04 Aug 2003 02:42:09 -0400
Date: Mon, 04 Aug 2003 02:42:09 -0400
From: mschilli1@aol.com
To: richardc@unixbeard.net
Subject: File::Find::Rule doesn't like prune() and or()
MIME-Version: 1.0
Message-ID: <003BF244.211D1C15.0271DDC6@aol.com>
X-Mailer: Atlas Mailer 2.0
X-AOL-IP: 63.201.95.187
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Hey Richard,
thanks for the File::Find::Rule modules, I like it a lot. I found one case, however, which I think used to work until recently, but doesn't anymore: If you use prune() in connection with or(), it won't find anything anymore, even if the prune() never kicks in. Here's an example:
use File::Find::Rule;
my $prune = File::Find::Rule
->directory("no_such_dir_anywhere")
->prune # !!! Uncomment this line and it'll work
->discard;
my $files = File::Find::Rule->file();
my @found = File::Find::Rule
->or($prune, $files)
->in("/tmp");
print "Found ", scalar @found, " files\n";
__END__
I would expect it to never match the $prune rule (there's no directory called "no_such_dir_anywhere" in my /tmp) but this rule causes the find to not find any files anymore. However, if you uncomment the line containing prune() as indicated in the listing above, everything works fine and all files under /tmp are returned.
-- Mike
############################
# Mike Schilli #
# log4perl@perlmeister.com #
# http://perlmeister.com #
# log4perl.sourceforge.net #
############################