Subject: | error from nested or(), or(), exec() |
Date: | Tue, 02 Jun 2009 08:52:05 +1000 |
To: | bug-File-Find-Rule [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
With File-Find-Rule 0.30 and recent debian i386 perl 5.10.0, the program
foo.pl below
the program foo.pl below
perl foo.pl
gets an error
Can't use string ("") as a subroutine ref while "strict refs" in use at (eval 46) line 25.
where I hoped it would print the names of the files under /tmp. It
probably depends on /tmp being not empty to get the problem, so if it
seems to succeed try in('/') instead.
The $exec or $or rules alone run fine, but the $or_or nested "or" fails.
I noticed this with the "perlver" program from Perl::MinimumVersion. It
makes an ->any() of a File::File::Rule::Perl ->perl_file(), the latter
being an ->or() of an ->exec().
use strict;
use warnings;
use File::Find::Rule;
sub callback {
print "callback\n";
return 1;
}
my $exec = File::Find::Rule->exec (\&callback);
my $or = File::Find::Rule->or ($exec);
my $or_or = File::Find::Rule->or ($or);
print $or_or->in('/tmp');