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

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

From:
James E Keenan via RT
Date:
October 17, 2018 13:13
Subject:
[perl #133170] Document deprecation of sysread on :utf8 handles
Message ID:
rt-4.0.24-28439-1539781986-677.133170-15-0@perl.org
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?

Thank you very much.

-- 
James E Keenan (jkeenan@cpan.org)

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



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