Date: Sat, 10 Feb 2001 14:04:40 -0800 (PST)
Message-ID: <Pine.LNX.4.21.
0102101356000.15298-100000@mako.covalent.net>
Subject: Re: [patch] GvSHARED
From: Doug MacEachern <dougm@covalent.net>
Date: Sat, 10 Feb 2001 15:00:54 -0800 (PST)
Message-ID: <Pine.LNX.4.21.
0102101453220.15298-100000@mako.covalent.net>
Subject: [patch] attributes.pm support for `shared'
From: Doug MacEachern <dougm@covalent.net>
Date: Sat, 10 Feb 2001 20:08:48 -0800 (PST)
Message-ID: <Pine.LNX.4.21.
0102102004190.15298-100000@mako.covalent.net>
our() attributes were ignored, our :shared pieces missing,
allow attributes.pm to turn on shared.
p4raw-id: //depot/perl@8766
} else if (type == OP_RV2SV || /* "our" declaration */
type == OP_RV2AV ||
type == OP_RV2HV) { /* XXX does this let anything illegal in? */
+ if (attrs) {
+ GV *gv = cGVOPx_gv(cUNOPo->op_first);
+ PL_in_my = FALSE;
+ PL_in_my_stash = Nullhv;
+ apply_attrs(GvSTASH(gv),
+ (type == OP_RV2SV ? GvSV(gv) :
+ type == OP_RV2AV ? (SV*)GvAV(gv) :
+ type == OP_RV2HV ? (SV*)GvHV(gv) : (SV*)gv),
+ attrs);
+ }
o->op_private |= OPpOUR_INTRO;
return o;
} else if (type != OP_PADSV &&
sub X::foo { 1 }
*Y::bar = \&X::foo;
*Y::bar = \&X::foo; # second time for -w
-eval 'package Z; sub Y::bar : locked';
+eval 'package Z; sub Y::bar : foo';
mytest qr/^X at /;
BEGIN {++$ntests}
-my @attrs = eval 'attributes::get \&Y::bar';
+eval 'package Z; sub Y::baz : locked {}';
+my @attrs = eval 'attributes::get \&Y::baz';
mytest '', "@attrs", "locked";
BEGIN {++$ntests}
process, and shouldn't bother appending recognized
flags. To experiment with that, uncomment the
following "else": */
- /* else */
+ else
attrs = append_elem(OP_LIST, attrs,
newSVOP(OP_CONST, 0,
newSVpvn(s, len)));
continue;
}
break;
+ case 's':
+ if (strEQ(name, "shared")) {
+ if (negated)
+ GvSHARED_off(CvGV((CV*)sv));
+ else
+ GvSHARED_on(CvGV((CV*)sv));
+ continue;
+ }
+ break;
}
break;
}
break;
default:
- /* nothing, yet */
+ switch ((int)len) {
+ case 6:
+ switch (*name) {
+ case 's':
+ if (strEQ(name, "shared")) {
+ /* toke.c has already marked as GvSHARED */
+ continue;
+ }
+ }
+ }
break;
}
/* anything recognized had a 'continue' above */
#endif
if (cvflags & CVf_METHOD)
XPUSHs(sv_2mortal(newSVpvn("method", 6)));
+ if (GvSHARED(CvGV((CV*)sv)))
+ XPUSHs(sv_2mortal(newSVpvn("shared", 6)));
break;
default:
break;