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

RFC: POSIX::setlocale stub

From:
Karl Williamson
Date:
April 25, 2014 18:41
Subject:
RFC: POSIX::setlocale stub
Message ID:
535AAC88.4080007@khwilliamson.com
I'm proposing to make platforms without locale handling to appear to 
Perl and XS code as if they do have locale handling, albeit with just 
the single locale "C", with synonym "POSIX".  This allows existing 
applications that use locale to be ported to, say Android, without 
having to change.

v5.20 does some of this now, as it allows one to 'use locale' on 
machines that don't allow locale handling.  The code behaves as if it 
were in the C locale, as it is available on all machines.

But there are platforms that don't even have a setlocale() stub, and so 
the current solution is not complete. I'm proposing to create a 
POSIX::setlocale() stub on such platforms.  The stub would do nothing 
except provide a return value.  For querying the existing locale, it 
would return "C"; for changing the locale, it would return failure 
(undef) unless the new locale were POSIX or C, in which case it would 
return the string "C", indicating success.

We would also have create fake values for the categories passable to 
setlocale(),  so we would define &POSIX::LC_ALL, etc.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About