On 04/14/2014 01:55 PM, Dave Mitchell wrote: > 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 > > > Thanks that sounds the easiest; I will do so when blead unfreezesThread Previous | Thread Next