In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/12cfc3ac0d36a97eddefa925ba09d0b21feb23a0?hp=ff36bb50a704e1926451063369ace915b3074f06>

- Log -----------------------------------------------------------------
commit 12cfc3ac0d36a97eddefa925ba09d0b21feb23a0
Author: Father Chrysostomos <[email protected]>
Date:   Tue Mar 24 22:03:15 2015 -0700

    regen pod issues

M       t/porting/known_pod_issues.dat

commit f942a0dfa923e36f91c00b44e21563cd50dc750b
Author: Father Chrysostomos <[email protected]>
Date:   Tue Mar 24 22:02:11 2015 -0700

    [perl #122322] Update OOK example in perlguts
    
    It was not just the COW changes that needed to be accounted for, but
    also the change in the storage of the offset.  The latter changed hap-
    pened in 5.12, I think.

M       pod/perlguts.pod
-----------------------------------------------------------------------

Summary of changes:
 pod/perlguts.pod               | 38 ++++++++++++++++++++++++++++----------
 t/porting/known_pod_issues.dat |  3 ++-
 2 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/pod/perlguts.pod b/pod/perlguts.pod
index 7af5369..9761bad 100644
--- a/pod/perlguts.pod
+++ b/pod/perlguts.pod
@@ -323,22 +323,40 @@ Hence, at this point, the start of the buffer that we 
allocated lives
 at C<SvPVX(sv) - SvIV(sv)> in memory and the PV pointer is pointing
 into the middle of this allocated storage.
 
-This is best demonstrated by example:
+This is best demonstrated by example.  Normally copy-on-write will prevent
+the substitution from operator from using this hack, but if you can craft a
+string for which copy-on-write is not possible, you can see it in play.  In
+the current implementation, the final byte of a string buffer is used as a
+copy-on-write reference count.  If the buffer is not big enough, then
+copy-on-write is skipped.  First have a look at an empty string:
+
+  % ./perl -Ilib -MDevel::Peek -le '$a=""; $a .= ""; Dump $a'
+  SV = PV(0x7ffb7c008a70) at 0x7ffb7c030390
+    REFCNT = 1
+    FLAGS = (POK,pPOK)
+    PV = 0x7ffb7bc05b50 ""\0
+    CUR = 0
+    LEN = 10
+
+Notice here the LEN is 10.  (It may differ on your platform.)  Extend the
+length of the string to one less than 10, and do a substitution:
 
-  % ./perl -Ilib -MDevel::Peek -le '$a="12345"; $a=~s/.//; Dump($a)'
-  SV = PVIV(0x8128450) at 0x81340f0
+  % ./perl -Ilib -MDevel::Peek -le '$a=""; $a.="123456789"; $a=~s/.//; 
Dump($a)'
+  SV = PV(0x7ffa04008a70) at 0x7ffa04030390
     REFCNT = 1
     FLAGS = (POK,OOK,pPOK)
-    IV = 1  (OFFSET)
-    PV = 0x8135781 ( "1" . ) "2345"\0
-    CUR = 4
-    LEN = 5
+    OFFSET = 1
+    PV = 0x7ffa03c05b61 ( "\1" . ) "23456789"\0
+    CUR = 8
+    LEN = 9
 
-Here the number of bytes chopped off (1) is put into IV, and
-C<Devel::Peek::Dump> helpfully reminds us that this is an offset.  The
+Here the number of bytes chopped off (1) is shown next as the OFFSET.  The
 portion of the string between the "real" and the "fake" beginnings is
 shown in parentheses, and the values of C<SvCUR> and C<SvLEN> reflect
-the fake beginning, not the real one.
+the fake beginning, not the real one.  (The first character of the string
+buffer happens to have changed to "\1" here, not "1", because the current
+implementation stores the offset count in the string buffer.  This is
+subject to change.)
 
 Something similar to the offset hack is performed on AVs to enable
 efficient shifting and splicing off the beginning of the array; while
diff --git a/t/porting/known_pod_issues.dat b/t/porting/known_pod_issues.dat
index 7d53853..2f39815 100644
--- a/t/porting/known_pod_issues.dat
+++ b/t/porting/known_pod_issues.dat
@@ -1,4 +1,4 @@
-# This file is the data file for porting/podcheck.t.
+# This file is the data file for t/porting/podcheck.t.
 # There are three types of lines.
 # Comment lines are white-space only or begin with a '#', like this one.  Any
 #   changes you make to the comment lines will be lost when the file is
@@ -278,6 +278,7 @@ pod/perlgit.pod     Verbatim line length including indents 
exceeds 79 by    12
 pod/perlgpl.pod        Verbatim line length including indents exceeds 79 by    
50
 pod/perlguts.pod       ? Should you be using F<...> or maybe L<...> instead of 
2
 pod/perlguts.pod       ? Should you be using L<...> instead of 1
+pod/perlguts.pod       Verbatim line length including indents exceeds 79 by    
1
 pod/perlhack.pod       ? Should you be using L<...> instead of 1
 pod/perlhist.pod       Verbatim line length including indents exceeds 79 by    
1
 pod/perlhpux.pod       Verbatim line length including indents exceeds 79 by    
7

--
Perl5 Master Repository

Reply via email to