Y
yary
File::Find always calls "wanted" with "." before calling preprocess
for the first directory. I can work around it, but it doesn't seem
right: the docs say "Your preprocessing function is called after
readdir(), but before the loop that calls the wanted() function."
Or is there a subtle reason why find calls "wanted" with ".", before
letting preprocess change the list of entries, which I should be
appreciating?
A simple program illustrating the order of calls-
#!/usr/bin/perl
use File::Find;
sub wanted { print " I found entry $_\n" }
sub pre { print " Entering $File::Find::dir\n"; @_}
sub post {print " leaving $File::Find::dir\n";}
find ({wanted => \&wanted, preprocess => \&pre, postprocess =>
\&post },'.');
__END__
in an empty dir, produces:
I found entry .
Entering .
leaving .
I expected "Entering ." to be the first line. Tried this on different
machines with perl 5.8 and 5.10.0 with the same results.
thanks for any elucidation
-y
for the first directory. I can work around it, but it doesn't seem
right: the docs say "Your preprocessing function is called after
readdir(), but before the loop that calls the wanted() function."
Or is there a subtle reason why find calls "wanted" with ".", before
letting preprocess change the list of entries, which I should be
appreciating?
A simple program illustrating the order of calls-
#!/usr/bin/perl
use File::Find;
sub wanted { print " I found entry $_\n" }
sub pre { print " Entering $File::Find::dir\n"; @_}
sub post {print " leaving $File::Find::dir\n";}
find ({wanted => \&wanted, preprocess => \&pre, postprocess =>
\&post },'.');
__END__
in an empty dir, produces:
I found entry .
Entering .
leaving .
I expected "Entering ." to be the first line. Tried this on different
machines with perl 5.8 and 5.10.0 with the same results.
thanks for any elucidation
-y