D
Dave Saville
Playing with File::Find and I seem to have found an oddity.
In a "wanted" routine -M _ differs from -M $_ depending on whether one
processes files or not: Test directory has two sub directories in it.
[T:\tmp\Test]ls -lR
total 0
drwxrwx--- 0 Dec 24 14:42 dir1
drwxrwx--- 0 Dec 24 14:42 dir2
dir1:
total 0
-rw-rw---a 0 Dec 24 14:37 stuff1
dir2:
total 0
-rw-rw---a 0 Dec 24 14:42 stuff2
use strict;
use warnings;
use File::Find;
my $d = shift || '';
#print time(), "\n";
$^T=1293201891; # fix basetime to keep numbers the same between runs
finddepth(\¬wanted, '.');
exit;
sub notwanted
{
return if m/^\.$/; # Don't need '.'
return if $d && ! -d; # only directories
print $_, ' ';
print -M _, " ";
print -M $_, " ";
print "\n";
}
[T:\tmp\Test]../try.pl
stuff1 0.00533564814814815 0.00533564814814815
dir1 0.00533564814814815 0.00167824074074074
stuff2 0.00140046296296296 0.00140046296296296
dir2 0.00140046296296296 0.00149305555555556
[T:\tmp\Test]../try.pl d
dir1 0.00167824074074074 0.00167824074074074
dir2 0.00149305555555556 0.00149305555555556
find() and finddepth() do the same thing - which is not surprising as
it always does finddepth and inverts the results. It's not the OS.
Does the same thing on two different ones. OS/2 and Ubuntu.
Hmm.......... Knowing me I am missing something
In a "wanted" routine -M _ differs from -M $_ depending on whether one
processes files or not: Test directory has two sub directories in it.
[T:\tmp\Test]ls -lR
total 0
drwxrwx--- 0 Dec 24 14:42 dir1
drwxrwx--- 0 Dec 24 14:42 dir2
dir1:
total 0
-rw-rw---a 0 Dec 24 14:37 stuff1
dir2:
total 0
-rw-rw---a 0 Dec 24 14:42 stuff2
use strict;
use warnings;
use File::Find;
my $d = shift || '';
#print time(), "\n";
$^T=1293201891; # fix basetime to keep numbers the same between runs
finddepth(\¬wanted, '.');
exit;
sub notwanted
{
return if m/^\.$/; # Don't need '.'
return if $d && ! -d; # only directories
print $_, ' ';
print -M _, " ";
print -M $_, " ";
print "\n";
}
[T:\tmp\Test]../try.pl
stuff1 0.00533564814814815 0.00533564814814815
dir1 0.00533564814814815 0.00167824074074074
stuff2 0.00140046296296296 0.00140046296296296
dir2 0.00140046296296296 0.00149305555555556
[T:\tmp\Test]../try.pl d
dir1 0.00167824074074074 0.00167824074074074
dir2 0.00149305555555556 0.00149305555555556
find() and finddepth() do the same thing - which is not surprising as
it always does finddepth and inverts the results. It's not the OS.
Does the same thing on two different ones. OS/2 and Ubuntu.
Hmm.......... Knowing me I am missing something