hmerrill has asked for the wisdom of the Perl Monks concerning the following question:

I'm on Red Hat 7.3 linux with Perl 5.6.1, and I recently discovered that Filename Globbing *sometimes* did not work in a subclass under mod_perl. I was attempting to determine whether there is a "CVS" directory in the current directory, so my subclass had this loop:
while (<CVS*>) { blah blah }
Most of the time that worked - when there was a "CVS" directory in the current directory, that loop would find it. However, fairly frequently I found that that loop would NOT find the "CVS" directory when it *WAS* actually there. Is there a known filename globbing bug? TIA.

Replies are listed 'Best First'.
Re: File Globbing bug?
by Abigail-II (Bishop) on Aug 05, 2002 at 15:47 UTC
    You mean, a file globbing bug specially when globbing for CVS*. Quite unlikely, don't you think?

    Are you sure your current directory is what you think it is? Also, if all you want to know whether there is a CVS directory, why don't you use -d "CVS"?

    Abigail

      No, what I mean is is there a file globbing bug that occurs when you enter some characters, and then a wildcard asterisk as a file glob, like <CVS*>?

      The current directory _is_ what I think it is - most of the time the <CVS*> works in finding the CVS directory when it is present, but somethimes it doesn't. I cannot reproduce this every time - it only happens sometimes.

      As soon as I sent the message, I realized that the -d test is what I should be using, so the code has been changed. But aside from that, does file globbing have a bug when specifying the first X characters in a filename followed by an asterisk wildcard?
        Perhaps it does, but then it's unknown (it would be fixed if it was known).

        Please write a small program that exhibits the bug and use the perlbug command to report it.

        Abigail