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

RFC: POSIX::setlocale stub

Karl Williamson
April 25, 2014 18:41
RFC: POSIX::setlocale stub
Message ID:
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. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About