Fix Attribute::Handlers to cope with proxy constant subroutines.
Nicholas Clark [Wed, 29 Nov 2006 10:19:19 +0000 (10:19 +0000)]
p4raw-id: //depot/perl@29414

MANIFEST
lib/Attribute/Handlers.pm
lib/Attribute/Handlers/t/constants.t [new file with mode: 0644]

index 38ca45f..468272f 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -1392,6 +1392,7 @@ lib/Attribute/Handlers/demo/Descriptions.pm       Attribute::Handlers demo
 lib/Attribute/Handlers/demo/MyClass.pm Attribute::Handlers demo
 lib/Attribute/Handlers.pm      Attribute::Handlers
 lib/Attribute/Handlers/README          Attribute::Handlers
+lib/Attribute/Handlers/t/constants.t   Test constants and Attribute::Handlers
 lib/Attribute/Handlers/t/linerep.t     See if Attribute::Handlers works
 lib/Attribute/Handlers/t/multi.t       See if Attribute::Handlers works
 lib/attributes.pm              For "sub foo : attrlist"
index 35484be..6bd121b 100644 (file)
@@ -16,6 +16,7 @@ sub findsym {
        no strict 'refs';
         foreach my $sym ( values %{$pkg."::"} ) {
            use strict;
+           next unless ref ( \$sym ) eq 'GLOB';
             return $symcache{$pkg,$ref} = \$sym
                if *{$sym}{$type} && *{$sym}{$type} == $ref;
        }
diff --git a/lib/Attribute/Handlers/t/constants.t b/lib/Attribute/Handlers/t/constants.t
new file mode 100644 (file)
index 0000000..746a87e
--- /dev/null
@@ -0,0 +1,13 @@
+BEGIN {
+    if ($ENV{PERL_CORE}) {
+       chdir 't' if -d 't';
+       @INC = '../lib';
+    }
+}
+use strict;
+use Test::More tests => 1;
+use Attribute::Handlers;
+# This had been failing since the introduction of proxy constant subroutines
+use constant SETUP => undef;
+sub Test : ATTR(CODE) { };
+ok(1, "If we got here, CHECK didn't fail");