Change 18404 by jhi@lyta on 2003/01/03 02:54:46
Subject: [PATCH] Re: Attribute::Handlers phase variance
From: Richard Clamp <[EMAIL PROTECTED]>
Date: Mon, 9 Dec 2002 11:10:24 +0000
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
... //depot/maint-5.8/perl/lib/Attribute/Handlers.pm#3 edit
... //depot/maint-5.8/perl/lib/Attribute/Handlers/t/multi.t#2 edit
Differences ...
==== //depot/maint-5.8/perl/lib/Attribute/Handlers.pm#3 (text) ====
Index: perl/lib/Attribute/Handlers.pm
--- perl/lib/Attribute/Handlers.pm#2~18080~ Sun Nov 3 21:23:04 2002
+++ perl/lib/Attribute/Handlers.pm Thu Jan 2 18:54:46 2003
@@ -137,7 +137,8 @@
%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}];
==== //depot/maint-5.8/perl/lib/Attribute/Handlers/t/multi.t#2 (text) ====
Index: perl/lib/Attribute/Handlers/t/multi.t
--- perl/lib/Attribute/Handlers/t/multi.t#1~17645~ Fri Jul 19 12:29:57 2002
+++ perl/lib/Attribute/Handlers/t/multi.t Thu Jan 2 18:54:46 2003
@@ -184,3 +184,17 @@
ok( $match, 52 );
}
+
+# The next two check for the phase invariance that Marcel spotted.
+# Subject: Attribute::Handlers phase variance
+# Message-Id: <[EMAIL PROTECTED]>
+
+my ($code_applied, $scalar_applied);
+sub Scotty :ATTR(CODE,BEGIN) { $code_applied = $_[5] }
+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 );
End of Patch.