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

[perl #133170] Document deprecation of sysread on :utf8 handles

Thread Previous
From:
Tony Cook via RT
Date:
October 22, 2018 23:53
Subject:
[perl #133170] Document deprecation of sysread on :utf8 handles
Message ID:
rt-4.0.24-3550-1540252390-246.133170-15-0@perl.org
On Wed, 17 Oct 2018 06:13:06 -0700, jkeenan wrote:
> On Sun, 06 May 2018 23:35:33 GMT, tonyc wrote:
> > On Thu, 03 May 2018 16:41:07 -0700, jim.avera@gmail.com wrote:
> > > On 5/3/18 2:40 AM, Tony Cook via RT wrote:
> > > > The underlying problem is that sysread() etc pay attention to only
> > > > one part of the layer stack - whether that PERLIO_K_UTF8 flag is
> > > > set,
> > > > at which point it ignores the rest, slurps in the bytes and marks
> > > > them as SVf_UTF8.
> > > >
> > > > With non-PERLIO_K_UTF8 layers sysread etc completely ignore the
> > > > layers - reading (or writing) bytes from/to the underlying stream.
> > >
> > > Hmm.  That's an unfortunate complexity involving perl's internal
> > > character representation which users really shouldn't need to be
> > > aware
> > > of.   I hope some solution can be found which doesn't _require_
> > > documenting and user-understanding of this.
> > >
> > > Is there any foreseeable path to making sysread() handle arbitrary
> > > layers correctly, using buffering when data-transforming layers are
> > > present but not otherwise?  What if sysread just called fh->read() in
> > > those cases?
> > 
> > Well, that would completely change the behaviour of sysread() in the
> > case of non-UTF-8 flagged file handles that have other layers on them.
> > 
> > One reason for making this a deprecation warning is so we're not
> > silently changing this behaviour.
> > 
> > This deprecation was originally discussed in:
> > 
> > https://rt.perl.org/Ticket/Display.html?id=125760
> > 
> > Tony
> 
> Tony:  Should the patch you proposed in this RT be applied now?

No, this ticket is obsoleted by those operators now being fatal on :utf8 handles and the documentation updates that included.

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=133170

Thread Previous


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