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

Re: [perl #118795] locale changes in 5.19.1 break LC_NUMERIC handling

Thread Previous | Thread Next
John Peacock
July 8, 2013 22:04
Re: [perl #118795] locale changes in 5.19.1 break LC_NUMERIC handling
Message ID:
On 07/08/2013 09:20 AM, Leon Timmermans wrote:
> perllocale does, though «By default, Perl ignores the current locale.
> The use locale pragma tells Perl to use the current locale for some
> operations.»

That sentence doesn't mention setlocale at all, which is a completely 
different topic from respecting the ENV locale.  Indeed, theexample code 
in perllocale for setlocale() itself does not include 'use locale'. 
Although, to be fair, the documentation for LC_NUMERIC does.

> The old behavior is crazy, especially the way the stringification
> sticks to the number even after the locale is out of scope. This has
> been discussed on this list previously.

I am not arguing that the old behaviour was completely correct.  I am 
arguing that POSIX::setlocale() has been changed without warning. 
Either make POSIX enable 'use locale' globally or load it automatically 
when locale_h is imported (or better yet only just prior to 
setlocale/localconv being called).

I do not think that adding documentation to POSIX is more than a thin 
layer of tissue paper over the real issue.  setlocale() has operated 
with the old (albeit broken) behaviour for 13 years; merely adding 
documentation is not sufficient, IMNSHO.  I would even consider it 
proper to emit a fatal error if setlocale() is called outside of a 'use 
locale' block.  Silent changes in behaviour are not useful to anyone.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About