develooper Front page | perl.perl5.porters | Postings from April 2014

Re: lib/locale.t warnings

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
April 14, 2014 19:55
Subject:
Re: lib/locale.t warnings
Message ID:
20140414195548.GI17980@iabyn.com
On Mon, Apr 14, 2014 at 01:31:14PM -0600, Karl Williamson wrote:
> In my experiments, when I set one of these variables to 'invalid'
> the environment variable didn't actually change from its previous
> value, hence the test was testing against its previous value, and
> not 'invalid'.  So the test isn't testing what it thinks it is.  I
> probably just used my usual ksh
> 
> ksh
> $ LC_ALL=en_US.utf8
> $ echo $LC_ALL
> en_US.utf8
> $ LC_ALL=invalid
> invalid: unknown locale
> $ echo $LC_ALL
> en_US.utf8

Ah I see. Well, it's easy to skip the test if the shell doesn't propagate
LC_ALL is to just test the value of $ENV{LC_ALL}, and if not equal to
"invalid", then the parent shell hasn't propagated the value, and just
return the expected value; so something like:

            fresh_perl_is(<<EOF, "$difference", { stderr => "devnull" },
                use locale;
                use POSIX qw(locale_h);
                if (\$ENV{LC_ALL} ne "invalid") {
                    print "$difference\n";
                    exit 0;
                }
                setlocale(LC_NUMERIC, "");
                my \$in = 4.2;
                printf("%g", \$in);
EOF



-- 
Little fly, thy summer's play my thoughtless hand
has terminated with extreme prejudice.
        (with apologies to William Blake)

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