On Thu, Aug 10, 2006 at 07:18:03PM +1000, Brendan O'Dea wrote: > On Sun, Jul 23, 2006 at 09:05:43PM +0200, Helge Kreutzmann wrote: > >I am trying to write a locale aware program. As I understand the > >perl documentation (mainly the man page perllocale) perl is currently > >dealing only with output (I will discuss this man page in a different > >wishlist bug later). So I attempt to construct an input routine. > > I'm not sure if this is a documentation bug or an implementation one. > > The perllocale(1) manual page states that: > > In the scope of "use locale", Perl obeys the "LC_NUMERIC" locale > information [...] > > although the locale(3) man page mentions only LC_CTYPE and LC_COLLATE. > > It appears that the latter is correct: > > $ LANG=de_DE perl -Mlocale -le 'print 2/5' > 0.4 > $ LANG=de_DE perl -MPOSIX=setlocale,LC_ALL -le 'setlocale LC_ALL, ""; print > 2/5' > 0,4 > $ LANG=de_DE perl -MPOSIX=setlocale,LC_NUMERIC -le 'setlocale LC_NUMERIC, > ""; print 2/5' > 0,4 > > an explicit setlocale is required to change the behaviour of gcvt .
As a minimum, perllocale(1) should be updated, i.e. the example should become: #!/usr/bin/perl use POSIX qw(strtod setlocale LC_NUMERIC); setlocale LC_NUMERIC, ""; $n = 5/2; # Assign numeric 2.5 to $n $a = " $n"; # Locale-dependent conversion to string print "half five is $n\n"; # Locale-dependent output printf "half five is %g\n", $n; # Locale-dependent output print "DECIMAL POINT IS COMMA\n" if $n == (strtod("2,5"))[0]; # Locale-dependent conversion I don't know if you had time to discuss with upstream where the bug lies, but at least this way documentation and implementation are in sync. -- Dr. Helge Kreutzmann [EMAIL PROTECTED] Dipl.-Phys. http://www.helgefjell.de/debian.php 64bit GNU powered gpg signed mail preferred Help keep free software "libre": http://www.ffii.de/
signature.asc
Description: Digital signature