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

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

Thread Next
From:
James E Keenan via RT
Date:
April 21, 2016 01:53
Subject:
[perl #127518] Clarification for the return type of pos() in doc
Message ID:
rt-4.0.18-16500-1461203581-1239.127518-15-0@perl.org
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)?

Thank you very much.

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

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

Thread Next


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