develooper Front page | perl.perl5.porters | Postings from August 2017

Re: my_strerror() as API function

Thread Previous | Thread Next
August 12, 2017 17:55
Re: my_strerror() as API function
Message ID:
I wrote:
>                                          It provides a useful facility
>that's otherwise difficult to achieve: errno-based messages that are
>responsive to "use locale" in the same way as $!.

Actually it's not quite the same, because there's an encoding issue.
In scope of "use locale", my_strerror() returns a string encoded in the
locale's charset.  $! uses a dodgy heuristic to sometimes decode this.

As a CPAN author, it'd be nice to have an API function that shows
what would go into $! for a given errno.  It'd have to return an SV,
or operate by writing to a supplied SV.  Currently the behaviour would
be my_strerror() plus dubious setting of SvUTF8.

As a core coder and general Perl programmer, it'd be nice to have proper
string decoding on $!.  It should be decoded based on the actual character
encoding of the locale that supplied the string, not just a guess.
It should be decoded regardless of what the encoding is, not only if
it's UTF-8.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About