[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Why was File::Find broken ($topdev)
It seems the new File::Find (and find.pl) are no longer
backward compatible with older scripts that used $topdev.
(If I should submit this via perlbug, let me know)
I have some perl scripts that were generated long ago with
find2perl, and included -xdev
(sub wanted was comparing $dev (from the lstat of $_) with $topdev)
Unfortunately, I wrote the scripts before learning to
consistently use "-w", so I did not detect immediately that $topdev
was no longer initialized!
Anyway, the command line
find . -xdev -type d -print
prints what I would expect but the 5.005_63 perl find2perl
find2perl . -xdev -type d -print > /tmp/f2p.out
perl /tmp/f2p.out
Name "File::Find::topdev" used only once: possible typo at /tmp/f2p.out line 27.
Use of uninitialized value in numeric ne (!=) at /tmp/f2p.out line 26.
By the way perl 5.005_57 didn't have this problem.
Older find.pl's exported $topdev, and even older File/Find.pm's
included the lines
# Localize these rather than lexicalizing them for backwards
# compatibility.
local($topdir,$topdev,$topino,$topmode,$topnlink);
... and ...
(($topdev,$topino,$topmode,$topnlink) =
($Is_VMS ? stat($topdir) : lstat($topdir)))
|| (warn("Can't stat $topdir: $!\n"), next);
You will noticed even in lib/perl5/5.00563/find.pl
that these variables are exported:
*name = *File::Find::name;
*prune = *File::Find::prune;
*dir = *File::Find::dir;
*topdir = *File::Find::topdir;
*topdev = *File::Find::topdev;
*topino = *File::Find::topino;
*topmode = *File::Find::topmode;
*topnlink = *File::Find::topnlink;
although find2perl generates references to
$File::Find::topdev
directly.
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]