summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorSalvador FandiXXo <unknown>2005-06-15 13:54:53 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-06-15 14:40:40 +0000
commit61dbb99a522b2949bb5b65d33183104796a3c272 (patch)
tree4fee217db29a16bca2a6ab823ac84ed2a701d84e /op.c
parent97972285a7cc3296dc99230fa10f7a030afa733f (diff)
downloadperl-61dbb99a522b2949bb5b65d33183104796a3c272.tar.gz
[perl #36297] builtin attrs on subrutine declarations
From: Salvador "FandiXXo" (via RT) <perlbug-followup@perl.org> Message-ID: <rt-3.0.11-36297-115797.8.75971493113916@perl.org> p4raw-id: //depot/perl@24851
Diffstat (limited to 'op.c')
-rw-r--r--op.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/op.c b/op.c
index bfdd1aa127..7b4f477603 100644
--- a/op.c
+++ b/op.c
@@ -4232,6 +4232,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
STRLEN ps_len;
register CV *cv=0;
SV *const_sv;
+ I32 gv_fetch_flags;
const char * const name = o ? SvPVx_nolen_const(cSVOPo->op_sv) : Nullch;
@@ -4251,13 +4252,13 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
}
else
aname = Nullch;
- gv = name ? gv_fetchsv(cSVOPo->op_sv,
- GV_ADDMULTI | ((block || attrs) ? 0 : GV_NOINIT),
- SVt_PVCV)
+
+ gv_fetch_flags = (block || attrs || (CvFLAGS(PL_compcv) & CVf_BUILTIN_ATTRS))
+ ? GV_ADDMULTI : GV_ADDMULTI | GV_NOINIT;
+ gv = name ? gv_fetchsv(cSVOPo->op_sv, gv_fetch_flags, SVt_PVCV)
: gv_fetchpv(aname ? aname
: (PL_curstash ? "__ANON__" : "__ANON__::__ANON__"),
- GV_ADDMULTI | ((block || attrs) ? 0 : GV_NOINIT),
- SVt_PVCV);
+ gv_fetch_flags, SVt_PVCV);
if (o)
SAVEFREEOP(o);