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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link or
or How to display code and escape characters
are good places to start.