develooper Front page | perl.perl5.porters | Postings from October 2018

How to reset LC_TIME in time

Thread Next
From:
H.Merijn Brand
Date:
October 30, 2018 14:13
Subject:
How to reset LC_TIME in time
Message ID:
20181030151256.2adf5c10@pc09.procura.nl
I got a report from someone using one of my scripts that it started
being very noisy when they changed their LC_TIME to something that was
not showing up under 'locale -a'. Demo:

$ env LC_TIME=en_US.UTF-8 perl -wE'say 1'
1

$ env LC_TIME=en_US.UTF-9 perl -wE'say 1'
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_CTYPE = "en_US.UTF-8",
        LC_TIME = "en_US.UTF-9",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
1

So I suggested a BEGIN block but to no avail:

$ env LC_TIME=en_US.UTF-9 perl -wE'BEGIN{$ENV{LC_TIME}="en_US.UTF-8"} say 1'
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_CTYPE = "en_US.UTF-8",
        LC_TIME = "en_US.UTF-9",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
1

same for CHECK and INIT

Is there a way to timely reset LC_TIME inside a perl script *before*
I get that noise?

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.29   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

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