develooper Front page | perl.perl5.porters | Postings from June 2016

Re: [perl #127518] Clarification for the return type of pos() in doc

Thread Previous
From:
Dave Mitchell
Date:
June 20, 2016 08:40
Subject:
Re: [perl #127518] Clarification for the return type of pos() in doc
Message ID:
20160620083955.GD3289@iabyn.com
On Wed, Apr 20, 2016 at 06:53:02PM -0700, James E Keenan via RT wrote:
> On Fri Feb 12 17:47:43 2016, jkeenan wrote:
> > On Thu Feb 11 10:27:03 2016, jason.gibson@gmail.com wrote:
> > > This is a bug report for perl from jason.gibson@gmail.com,
> > > generated with the help of perlbug 1.39 running under perl 5.18.2.
> > > 
> > > 
> > > -----------------------------------------------------------------
> > > [Please describe your issue here]
> > > 
> > > The documentation for the core pos() function does not say whether or
> > > not the return value is in characters or bytes.
> > > 
> > > PAGER=cat perldoc -f pos | grep Return
> > >      pos     Returns the offset of where the last "m//g" search left
> > > off for
> > > 
> > > The offset is in characters, and the text could be improved by saying
> > > that.
> > > E.g. 'Returns the offset in characters unless the "bytes" pragma is in
> > > effect...'
> > > 
> > > perl -E 'binmode STDOUT, "encoding(UTF-8)"; $_ = "\N{U+10000}abc";
> > > say; say "chars: ${\length}"; /a/g; say "pos() chars: ${\pos}
> > > (default)"; use bytes; say "bytes: ${\length}"; say "pos() bytes:
> > > ${\pos}"'
> > > 𐀀abc
> > > chars: 4
> > > pos() chars: 2 (default)
> > > bytes: 7
> > > pos() bytes: 5
> > > 
> > > Thank you.
> > > 
> > 
> > Please review the patch attached.
> > 
> 
> While the OP liked the patch proposed, we didn't hear from any other
> committers.  Could we hear from committers so that we know whether to
> apply this (in 5.25.1)?

Looks good to me.

-- 
Technology is dominated by two types of people: those who understand what
they do not manage, and those who manage what they do not understand. 

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