Dear Monks,
I think I found a bug in the File::Util (File-Util-4.161200) package. $f->list_dir() doesn't work when no files are present in the directory. Can someone have a look if they see this too and this isn't an error on my part?
Case:
Step 1: Locate on your system a directory that contains no files, but can contain subdirectories. Example "/home/my_user/foo", containing "/home/my_user/foo/bar" and /home/my_user/foo/bar2".
Step 2: Try to list the directories with:
perl -e 'use strict; use File::Util;my $f = File::Util->new(); my @d = $f->list_dir("/home/my_user/foo/"); print join " ", @d, "\n";'This results in following error:
Can't use an undefined value as an ARRAY reference at /usr/local/share/perl/5.14.2/File/Util.pm line 452.Step 3: Create an file in "/home/my_user/foo/". Example "test.txt"
Step 4: Run the same perl snippet again. This results in the correct expected result:
. .. bar bar2 test.txtModule: File-Util-4.161200
Perl version:v5.14.2
System: Linux hostname 3.4.90 #2 SMP PREEMPT Tue Aug 5 14:11:40 CST 2014 armv7l GNU/Linux
I would appreciate that someone can confirm this before I report this as a bug to the maintainer of the package.
I tried the same code on a different system with File-Util-4.132140 and there it worked as expected
Kind regards
Martell
Update: All, thanks for the quick reactions and the verifying. I posted this as a bug report on cpan:
https://rt.cpan.org/Ticket/Display.html?id=115511
Update: I can confirm that the bug is resolved in version 4.161950. Thanks Tommy for your work.
In reply to Bug in latest File::Util? by martell
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |