Integrate changes to Attribute::Handlers from maint-5.8
authorRichard Clamp <richardc@unixbeard.net>
Mon, 9 Dec 2002 11:10:24 +0000 (11:10 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Thu, 16 Jan 2003 20:58:59 +0000 (20:58 +0000)
(18404 and 18427).
Subject: [PATCH] Re: Attribute::Handlers phase variance
Message-ID: <20021209111024.GA14365@mirth.demon.co.uk>

p4raw-id: //depot/perl@18499
p4raw-integrated: from //depot/maint-5.8/perl@18498 'copy in'
lib/Attribute/Handlers.pm (@18080..)
lib/Attribute/Handlers/t/multi.t (@18404..)

lib/Attribute/Handlers.pm
lib/Attribute/Handlers/t/multi.t

index a26ed18..9dfe783 100644 (file)
@@ -137,7 +137,8 @@ sub _gen_handler_AH_() {
                        %lastattr=(pkg=>$pkg,ref=>$ref,type=>$data);
                }
                else {
-                       my $handler = $pkg->can($attr);
+                       my $type = ref $ref;
+                       my $handler = $pkg->can("_ATTR_${type}_${attr}");
                        next unless $handler;
                        my $decl = [$pkg, $ref, $attr, $data,
                                    $raw{$handler}, $phase{$handler}];
index cddab91..db00b1c 100644 (file)
@@ -184,3 +184,20 @@ ok(1,52 ,"# Skip, no difference between lexical handlers and normal handlers pri
 ok( $match, 52 );
 }
 
+
+# The next two check for the phase invariance that Marcel spotted.
+# Subject: Attribute::Handlers phase variance
+# Message-Id: <54EDDB80-FD75-11D6-A18D-00039379E28A@noug.at>
+
+my ($code_applied, $scalar_applied);
+sub Scotty :ATTR(CODE,BEGIN)   { $code_applied = $_[5] }
+{
+no warnings 'redefine';
+sub Scotty :ATTR(SCALAR,CHECK) { $scalar_applied = $_[5] }
+}
+
+sub warp_coil :Scotty {}
+my $photon_torpedo :Scotty;
+
+ok( $code_applied   eq 'BEGIN', 53, "# phase variance" );
+ok( $scalar_applied eq 'CHECK', 54 );