Change 18499 by rgs@rgs-home on 2003/01/16 20:58:59

        Integrate changes to Attribute::Handlers from maint-5.8
        (18404 and 18427).
        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/perl/lib/Attribute/Handlers.pm#19 integrate
... //depot/perl/lib/Attribute/Handlers/t/multi.t#9 integrate

Differences ...

==== //depot/perl/lib/Attribute/Handlers.pm#19 (text) ====
Index: perl/lib/Attribute/Handlers.pm
--- perl/lib/Attribute/Handlers.pm#18~17978~    Fri Oct  4 21:44:10 2002
+++ perl/lib/Attribute/Handlers.pm      Thu Jan 16 12:58:59 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/perl/lib/Attribute/Handlers/t/multi.t#9 (text) ====
Index: perl/lib/Attribute/Handlers/t/multi.t
--- perl/lib/Attribute/Handlers/t/multi.t#8~17113~      Sat Jun  8 13:19:28 2002
+++ perl/lib/Attribute/Handlers/t/multi.t       Thu Jan 16 12:58:59 2003
@@ -184,3 +184,20 @@
 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] }
+{
+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 );
End of Patch.

Reply via email to