New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
various glob() bugs #1496
Comments
From tchrist@chthon.perl.comSummary: 1. Prototype change breaks documented examples. +--------------------------------------------------+ I seem to recall that this is my own fault: [ 5163] By: gsar on 2000/02/20 16:34:33 That made this: glob glob ck_glob t@ S? S? And that breaks this: use File::Glob ':glob'; Which used to say Gnat lives in /home/gnat But now says Too many arguments for glob at - line 3, near "GLOB_ERR)" So even though you import it, and even though it goes into <*> fileglobs, use File::Glob ':glob'; Yes, you have to use &glob to give another argument. I don't know a perfect solution here, but right now, there's *CORE::GLOBAL::glob = \&File::Glob::csh_glob; would make the parser tolerate 0 or 1 arguments, but with *CORE::GLOBAL::glob = \&File::Glob::glob; it would tolerate 0, 1, or 2 arguments. +------------------------+ There are other problems with this module. The import use File::Glob ':globally'; is a silent no-op on systems compiled with -DPERL_EXTERNAL_GLOB. *CORE::GLOBAL::glob = \&File::Glob::csh_glob; but that's what you have already. If you want to have space-sensitive use File::Glob ':glob'; But that's just that package. You can't use ':globally' *CORE::GLOBAL::glob = \&File::Glob::glob; So you have to do it yourself, which feels sleasy. Here's the demo. #!/bin/sh -x I think I prefer ":everywhere" to ":globally". It's far far too It would also be nice to get at File::Glob::glob without overriding the I think you should be able to say whether This package uses POSIX glob for the Perl fileglob operator. +----------------------------+ % perl5.004 -le 'print glob("*.[^x]")' That gets all the files that end in a dot followed by anything not % perl -le 'print glob("*.[^x]")' Because of this *.[!x] thing. And there's no way to get back +-----------------+ I notice in passing that csh_glob is not documented. And when it is, All of these things need doc'ing, including the various breakages. --tom |
From [Unknown Contact. See original ticket]Here's more. % touch foo.x foo.X % perl -le 'use File::Glob qw/:nocase glob/; print join(" ", glob("*.x"))' % perl -le 'use File::Glob qw/:nocase glob/; print join(" ", &glob("*.x"))' It is hard to see how that is an expected feature. % perl -le 'use File::Glob qw/:nocase :globally/; print join(" ", glob("*.x"))' % perl -le 'use File::Glob qw/:nocase :globally glob/; print join(" ", glob("*.x"))' % perl -le '{package XXX; use File::Glob qw/:nocase :globally/} print join(" ", glob("*.x"))' --tom |
From @smpetersThis is an old bug, but much of it appears to be fixed. My comments are
Magic seems to have been performed somewhere within the bowels. With
File::Glob and its funkiness has been embedded within Perl long enough use glob 'POSIX'; # Explicitly take the POSIX behavior, or For the global usage (although I personally believe this could break use glob qw(POSIX everywhere); # Explicitly take the POSIX behavior This is mostly an incomplete thought, but I'd be happy to listen to
That's due to a POSIX change (see
The current description contains the following. "The glob angle-bracket operator <> is a pathname generator that File::Glob::bsd_glob() implements the FreeBSD glob(3) routine, which is Since v5.6.0, Perl's CORE::glob() is implemented in terms of bsd_glob(). As far as documenting csh_glob, its documented internally with the "csh_glob() should not be used directly, unless you know what you're I'm not sure why this is, but this makes it difficult for me to suggest The problems encountered by Mac OS Classic users has been documented, as Overall, though, things seem better than the world of File::Glob at the |
Migrated from rt.perl.org#2707 (status was 'open')
Searchable as RT2707$
The text was updated successfully, but these errors were encountered: