in reply to Re^2: Portability of glob function in a modern perl
in thread Portability of glob function in a modern perl
A quick search through CPAN (provided by http://cpansearch.bulknews.net/) provides me with following ugly usages of glob that will not work for quoted spaces in the path, as the path is otherwise used for directly constructed filenames too:
... my $path = File::Spec->catdir($self->{mnt}, @path); ... # and $self->add_song(glob(File::Spec->catpath($self->{mnt}, "iPod_Control +", "Music", "*", "*")));
($self->{mnt} is supposed to be the mount point of the iPod)
my $dir = $self->storage_dir; ... my @files = map { scalar( s/\.$extension//, basename $_) } glob("$dir/*.$extension");
($self->storage_dir is supposed to be the directory for storage, unquoted)
... foreach my $dir ( @ARGV ) { unless ( -d $dir ) { warn("$dir: not a directory -- skipped\n"); next; } ... my @files = sort map { $1 if /([^\/]+)\.mp3$/ } glob("$dir/[0-9]*.mp +3");
Same as above
I stopped here, on page three of the results (when searching for glob).In short, a directory and it's glob-safe quoted string are not usable interchangeably, and thus will lead to problems with the authors that can't imagine/foresee whitespace in filenames.
As an aside, the cpansearch doesn't seem to like searching for "glob(", which would exclude a lot of "typeglob" results.
|
|---|