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

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

Thread Previous | Thread Next
From:
John Wiersba
Date:
September 14, 2013 03:00
Subject:
Re: [perl #119785] bsd_glob does not sort case-sensitively
Message ID:
1379127439.6494.YahooMailNeo@web162804.mail.bf1.yahoo.com
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:
      GLOB_NOSORT
      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 <perlbug-followup@perl.org>
>To: 
>Cc: perl5-porters@perl.org 
>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, jrw32982@yahoo.com wrote:
>> 
>> This is a bug report for perl from jrw32982@yahoo.com,
>> 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
>https://rt.perl.org:443/rt3/Ticket/Display.html?id=119785
>
>
>
Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About