develooper Front page | perl.perl5.porters | Postings from September 2013

Re: [perl #119785] bsd_glob does not sort case-sensitively

Thread Previous | Thread Next
John Wiersba
September 14, 2013 03:00
Re: [perl #119785] bsd_glob does not sort case-sensitively
Message ID:
OK.  I said that wrong.  My subject line says it better.  Looking at older versions (perl5.14 and earlier) of the doc for File::Glob, it appears that bsd_glob should sort in ASCII order.  But in fact, with only one argument it mixes upper and lowercase letters, sorting case-insensitively.   

It appears that all versions of the doc say:
      By default, the pathnames are sorted in ascending ASCII order; this
flag prevents that sorting (speeding up bsd_glob()).

This is confusing, because this is not the default when a single argument is specified.  Elsewhere in the latest version of the doc (perl5.16+), it says:
      If the second argument is omitted, GLOB_CSH(or GLOB_CSH|GLOB_NOCASEon VMS and DOSish systems) is used by default.

In older versions of the doc (perl5.4-), this information about the second argument is omitted.

So, I think what it means is:

When 1 arg is specified, GLOB_CSH is in effect, which means GLOB_ALPHASORT.  When 2 args are specified, ASCII sorting is the default unless overridden by GLOB_NOCASE or GLOB_ALPHASORT or GLOB_NOSORT.

In any case, it's not very clear.  I wasted a lot of time trying to get it to sort in ASCII order before I came up with:
   glob($pattern, GLOB_BRACE)
to force it to sort in ASCII order.

> From: James E Keenan via RT <>
>Sent: Friday, September 13, 2013 10:10 PM
>Subject: [perl #119785] bsd_glob does not sort case-sensitively
>On Fri Sep 13 12:23:13 2013, wrote:
>> This is a bug report for perl from,
>> generated with the help of perlbug 1.39 running under perl 5.16.3.
>> -----------------------------------------------------------------
>> [Please describe your issue here]
>> According to all versions of File::Glob's doc, it appears that it
>>    should
>> sort case-insensitively.  
>Can you explain where you got that concept?
>Under the section 'GLOB_NOCASE', the POD says:
>"By default, file names are assumed to be case sensitive ..."
>Thank you very much.
>Jim Keenan
>via perlbug:  queue: perl5 status: new
Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About