http://qs1969.pair.com?node_id=1207102


in reply to To glob or not to glob

Using it the way you describe will cause porting issues for older perl versions:

$ perl -MFile::Glob::bsd_glob -wE'say for bsd_glob ("*.foo")' Can't locate File/Glob/bsd_glob.pm in @INC (@INC contains: /pro/lib/pe +rl5/site_perl/5.14.2/IA64.ARCHREV_0-LP64-ld /pro/lib/perl5/site_perl/ +5.14.2 /pro/lib/perl5/5.14.2/IA64.ARCHREV_0-LP64-ld /pro/lib/perl5/5. +14.2 .). BEGIN failed--compilation aborted.

edit: correct above example of failure. The correct syntax is just as bad though:

$ perl -MFile::Glob=:bsd_glob -wE'say for bsd_glob ("*.foo")' "bsd_glob" is not defined in %File::Glob::EXPORT_TAGS at /pro/lib/perl +5/5.14.2/IA64.ARCHREV_0-LP64-ld/File/Glob.pm line 45. File::Glob::import("File::Glob", ":bsd_glob") called at -e lin +e 0 main::BEGIN() called at -e line 0 eval {...} called at -e line 0 Can't continue after import errors at -e line 0. BEGIN failed--compilation aborted.

And additional shit hits the fan when you would try to install it

$ cpan File::Glob : The most recent version "1.28" of the module "File::Glob" is part of the perl-5.26.1 distribution. ...

Does this in your opinion imply that File::Glob should be dual-lived?

The current (today) absolute advised minimum version to be supported by the toolchain is perl-5.8.1. My example with 5.14.2 could arguably be considered recent enough.

Digging in the Delta's:

perl561delta.pod: File::Glob::glob() has been renamed to File::Glob::bsd_glob() perl58delta.pod: File::Glob::glob() has been renamed to File::Glob::bsd_glob() perl5160delta.pod: It has a new C<:bsd_glob> export tag, intended to replace C<:glob>. perl5260delta.pod: L<C<File::Glob::glob()> will disappear in perl 5.30. Use C<File::Glo +b::bsd_glob()> instead.

Does *not* make me happy. I see the trouble that is addressed, but this makes portable programming much much harder. Looks like the only portable way to write it from 5.6.1 to blead is:

use File::Glob; my @files = File::Glob::bsd_glob ("*.txt");

Safe, but not really a nice replacement of the simple <*.txt> or glob ("*.txt").


Enjoy, Have FUN! H.Merijn