diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-09-06 16:22:53 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-09-15 06:19:33 -0700 |
commit | 02bd0dfcaf2882e9b8d96975db16fb4bdcdcbacf (patch) | |
tree | fad361a738cbd0f9561e4b39bf29d2b339e1afab /ext/Devel-Peek | |
parent | 7a11f5c382a3ea35768e2f50d7dbeaed6adc2398 (diff) | |
download | perl-02bd0dfcaf2882e9b8d96975db16fb4bdcdcbacf.tar.gz |
Tweak Peek.t
beab08741 introduced XSUB constants, but the code it added to
newATTRSUB does not set CvSTASH if there is already a CV stub. It
does set it if there is no sub there at all (because it goes through
newCONSTSUB).
Recent changes have made constant declarations like ‘sub foo(){}’
put just a constant reference in the stash if possible, the way con-
stant.pm does. When this gets upgraded to a typeglob, the CV is rei-
fied via newCONSTSUB, so it gets a CvSTASH pointer.
CvSTASH on a constant sub really makes no difference in practice.
It’s mostly cosmetic.
This exercises the two code paths with the oldest perl installa-
tion I have:
$ /opt/bin/perl5.8.8 -MDevel::Peek -e 'BEGIN{\&foo} sub foo(){3} Dump \&foo'
SV = RV(0x9baa18) at 0x98d580
REFCNT = 1
FLAGS = (TEMP,ROK)
RV = 0x9b7398
SV = PVCV(0x9b4810) at 0x9b7398
REFCNT = 2
FLAGS = (POK,pPOK,CONST)
IV = 0
NV = 0
PROTOTYPE = ""
COMP_STASH = 0x98d4a8 "main" <----------
ROOT = 0x0
XSUB = 0x5bb44
XSUBANY = 10018864
GVGV::GV = 0x98df7c "main" :: "foo"
FILE = "-e"
DEPTH = 0
FLAGS = 0x200
OUTSIDE_SEQ = 96
PADLIST = 0x98e228
PADNAME = 0x98e24c(0x0) PAD = 0x98e264(0x22d560)
OUTSIDE = 0x98df34 (UNIQUE)
$ /opt/bin/perl5.8.8 -MDevel::Peek -e 'sub foo(){3} Dump \&foo'
SV = RV(0xc11018) at 0xbe3b80
REFCNT = 1
FLAGS = (TEMP,ROK)
RV = 0xbe4570
SV = PVCV(0xc0ae10) at 0xbe4570
REFCNT = 2
FLAGS = (POK,pPOK,CONST)
IV = 0
NV = 0
PROTOTYPE = ""
COMP_STASH = 0x0 <--------------------------
ROOT = 0x0
XSUB = 0x5bb44
XSUBANY = 12469628
GVGV::GV = 0xbe3c40 "main" :: "foo"
FILE = "-e"
DEPTH = 0
FLAGS = 0x200
OUTSIDE_SEQ = 0
PADLIST = 0x0
OUTSIDE = 0x0 (null)
Diffstat (limited to 'ext/Devel-Peek')
-rw-r--r-- | ext/Devel-Peek/t/Peek.t | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/Devel-Peek/t/Peek.t b/ext/Devel-Peek/t/Peek.t index ce777da4e9..c601b6e4c9 100644 --- a/ext/Devel-Peek/t/Peek.t +++ b/ext/Devel-Peek/t/Peek.t @@ -698,7 +698,8 @@ do_test('constant subroutine', IV = 0 # $] < 5.009 NV = 0 # $] < 5.009 PROTOTYPE = "" - COMP_STASH = 0x0 + COMP_STASH = 0x0 # $] < 5.021004 + COMP_STASH = $ADDR "main" # $] >=5.021004 ROOT = 0x0 # $] < 5.009 XSUB = $ADDR XSUBANY = $ADDR \\(CONST SV\\) |