r40792 - in /branches/upstream/libmoosex-methodattributes-perl/current: ./ lib/MooseX/ lib/MooseX/MethodAttributes/ lib/MooseX/MethodAttributes/Role/ lib/MooseX/MethodAttributes/Role/AttrContainer/ lib/MooseX/MethodAttributes/Role/Meta/ lib/MooseX/MethodAttributes/Role/Meta/Method/ t/ t/lib/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Mon Jul 27 02:02:46 UTC 2009


Author: jawnsy-guest
Date: Mon Jul 27 02:02:36 2009
New Revision: 40792

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=40792
Log:
[svn-upgrade] Integrating new upstream version, libmoosex-methodattributes-perl (0.15)

Added:
    branches/upstream/libmoosex-methodattributes-perl/current/t/lib/OtherRoleWithAttributes.pm
    branches/upstream/libmoosex-methodattributes-perl/current/t/lib/UsesMultipleRoles.pm
    branches/upstream/libmoosex-methodattributes-perl/current/t/multiple_roles.t
    branches/upstream/libmoosex-methodattributes-perl/current/t/multiple_roles2.t
    branches/upstream/libmoosex-methodattributes-perl/current/t/role_with_anon_class.t
Modified:
    branches/upstream/libmoosex-methodattributes-perl/current/Changes
    branches/upstream/libmoosex-methodattributes-perl/current/MANIFEST
    branches/upstream/libmoosex-methodattributes-perl/current/META.yml
    branches/upstream/libmoosex-methodattributes-perl/current/Makefile.PL
    branches/upstream/libmoosex-methodattributes-perl/current/README
    branches/upstream/libmoosex-methodattributes-perl/current/dist.ini
    branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes.pm
    branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Inheritable.pm
    branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/AttrContainer.pm
    branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/AttrContainer/Inheritable.pm
    branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Class.pm
    branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Map.pm
    branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Method.pm
    branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Method/MaybeWrapped.pm
    branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Method/Wrapped.pm
    branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Role.pm
    branches/upstream/libmoosex-methodattributes-perl/current/t/lib/BaseClass.pm
    branches/upstream/libmoosex-methodattributes-perl/current/t/lib/ClassUsingRoleWithAttributes.pm
    branches/upstream/libmoosex-methodattributes-perl/current/t/lib/OtherSubClass.pm
    branches/upstream/libmoosex-methodattributes-perl/current/t/lib/RoleWithAttributes.pm
    branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClass.pm
    branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClassUseBaseAndUseMoose.pm
    branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubSubClass.pm
    branches/upstream/libmoosex-methodattributes-perl/current/t/lib/TestClass.pm

Modified: branches/upstream/libmoosex-methodattributes-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/Changes?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/Changes (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/Changes Mon Jul 27 02:02:36 2009
@@ -1,3 +1,15 @@
+0.15     Sun, Jul 26 18:02:05 2009 +0100
+  * Fix test which was failing in some cases and additional test cases.
+
+  * No other changes on the dev release.
+
+0.14_01  Thu, Jul 16 20:04:04 2009 +0100
+  * Add TODO tests for role combination with method attributes, proving that this doesn't work.
+
+  * Add nasty hack to allow the application of roles with method attributes to anon classes to
+    work if the user does a special handwave. This is less than optimum, see big block comment
+    in the code. :/
+
 0.14     Sun, Jun  7 01:51:49 2009 +0100
   * Fix bugs with composing roles with method attributes into other
     roles with method attributes + tests

Modified: branches/upstream/libmoosex-methodattributes-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/MANIFEST?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/MANIFEST (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/MANIFEST Mon Jul 27 02:02:36 2009
@@ -26,14 +26,19 @@
 t/inherited_non_moose_multilevel.t
 t/lib/BaseClass.pm
 t/lib/ClassUsingRoleWithAttributes.pm
+t/lib/OtherRoleWithAttributes.pm
 t/lib/OtherSubClass.pm
 t/lib/RoleWithAttributes.pm
 t/lib/SubClass.pm
 t/lib/SubClassUseBaseAndUseMoose.pm
 t/lib/SubSubClass.pm
 t/lib/TestClass.pm
+t/lib/UsesMultipleRoles.pm
+t/multiple_roles.t
+t/multiple_roles2.t
 t/override_method_with_no_attribute.t
 t/role.t
 t/role_applied.t
 t/role_in_role.t
-t/role_in_role_more.t
+t/role_in_role_more.t
+t/role_with_anon_class.t

Modified: branches/upstream/libmoosex-methodattributes-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/META.yml?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/META.yml (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/META.yml Mon Jul 27 02:02:36 2009
@@ -1,15 +1,19 @@
 ---
-abstract: code attribute introspection
+abstract: 'code attribute introspection'
 author:
-- Florian Ragwitz <rafl at debian.org>
-- Tomas Doran <bobtfish at bobtfish.net>
-generated_by: Dist::Zilla::Plugin::MetaYaml version 1.091260
+  - 'Florian Ragwitz <rafl at debian.org>'
+  - 'Tomas Doran <bobtfish at bobtfish.net>'
+generated_by: 'Dist::Zilla::Plugin::MetaYAML version 1.091440'
 license: perl
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
 name: MooseX-MethodAttributes
 requires:
-  Moose: '0.79'
-  MooseX::Types: '0.06'
-  Test::Exception: '0'
-  Test::More: '0'
-  namespace::clean: '0'
-version: '0.14'
+  MRO::Compat: 0
+  Moose: 0.79
+  MooseX::Types: 0.06
+  Test::Exception: 0
+  Test::More: 0
+  namespace::clean: 0
+version: 0.15

Modified: branches/upstream/libmoosex-methodattributes-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/Makefile.PL?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/Makefile.PL (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/Makefile.PL Mon Jul 27 02:02:36 2009
@@ -8,15 +8,16 @@
   DISTNAME  => 'MooseX-MethodAttributes',
   NAME      => 'MooseX::MethodAttributes',
   AUTHOR    => 'Florian\ Ragwitz\ \<rafl\@debian\.org\>\,\ Tomas\ Doran\ \<bobtfish\@bobtfish\.net\>',
-  ABSTRACT  => 'code attribute introspection',
-  VERSION   => '0.14',
+  ABSTRACT  => 'code\ attribute\ introspection',
+  VERSION   => '0.15',
   EXE_FILES => [ qw() ],
   (eval { ExtUtils::MakeMaker->VERSION(6.21) } ? (LICENSE => 'perl') : ()),
   PREREQ_PM    => {
+    "namespace::clean" => '0',
     "Test::More" => '0',
-    "namespace::clean" => '0',
     "Test::Exception" => '0',
     "MooseX::Types" => '0.06',
+    "MRO::Compat" => '0',
     "Moose" => '0.79',
   },
 );

Modified: branches/upstream/libmoosex-methodattributes-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/README?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/README (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/README Mon Jul 27 02:02:36 2009
@@ -1,7 +1,7 @@
 
 
 This archive contains the distribution MooseX-MethodAttributes, version
-0.14:
+0.15:
 
   code attribute introspection
 

Modified: branches/upstream/libmoosex-methodattributes-perl/current/dist.ini
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/dist.ini?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/dist.ini (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/dist.ini Mon Jul 27 02:02:36 2009
@@ -1,5 +1,5 @@
 name    = MooseX-MethodAttributes
-version = 0.14
+version = 0.15
 author  = Florian Ragwitz <rafl at debian.org>
 author  = Tomas Doran <bobtfish at bobtfish.net>
 license = Perl_5
@@ -11,6 +11,7 @@
 MooseX::Types = 0.06
 Test::Exception = 0
 Test::More = 0
+MRO::Compat = 0
 
 [@Filter]
 bundle = @Classic

Modified: branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes.pm Mon Jul 27 02:02:36 2009
@@ -2,7 +2,7 @@
 use warnings;
 
 package MooseX::MethodAttributes;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 # ABSTRACT: code attribute introspection
 
@@ -40,7 +40,7 @@
 
 =head1 VERSION
 
-version 0.14
+version 0.15
 
 =head1 SYNOPSIS
 

Modified: branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Inheritable.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Inheritable.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Inheritable.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Inheritable.pm Mon Jul 27 02:02:36 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Inheritable;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 # ABSTRACT: inheritable code attribute introspection
 
@@ -23,7 +23,7 @@
 
 =head1 VERSION
 
-version 0.14
+version 0.15
 
 =head1 SYNOPSIS
 

Modified: branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/AttrContainer.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/AttrContainer.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/AttrContainer.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/AttrContainer.pm Mon Jul 27 02:02:36 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Role::AttrContainer;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 # ABSTRACT: capture code attributes in the class' metaclass
 
@@ -24,7 +24,7 @@
 
 =head1 VERSION
 
-version 0.14
+version 0.15
 
 =head1 METHODS
 

Modified: branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/AttrContainer/Inheritable.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/AttrContainer/Inheritable.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/AttrContainer/Inheritable.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/AttrContainer/Inheritable.pm Mon Jul 27 02:02:36 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Role::AttrContainer::Inheritable;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 # ABSTRACT: capture code attributes in the automatically initialized metaclass instance
 
@@ -43,7 +43,7 @@
 
 =head1 VERSION
 
-version 0.14
+version 0.15
 
 =head1 DESCRIPTION
 

Modified: branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Class.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Class.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Class.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Class.pm Mon Jul 27 02:02:36 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Role::Meta::Class;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 # ABSTRACT: metaclass role for storing code attributes
 
@@ -108,7 +108,7 @@
 
 =head1 VERSION
 
-version 0.14
+version 0.15
 
 =head1 METHODS
 

Modified: branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Map.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Map.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Map.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Map.pm Mon Jul 27 02:02:36 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Role::Meta::Map;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 # ABSTRACT: role for storing code attributes
 
@@ -46,7 +46,7 @@
 
 =head1 VERSION
 
-version 0.14
+version 0.15
 
 =head1 METHODS
 

Modified: branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Method.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Method.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Method.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Method.pm Mon Jul 27 02:02:36 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Role::Meta::Method;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 # ABSTRACT: metamethod role allowing code attribute introspection
 
@@ -34,7 +34,7 @@
 
 =head1 VERSION
 
-version 0.14
+version 0.15
 
 =head1 ATTRIBUTES
 

Modified: branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Method/MaybeWrapped.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Method/MaybeWrapped.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Method/MaybeWrapped.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Method/MaybeWrapped.pm Mon Jul 27 02:02:36 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Role::Meta::Method::MaybeWrapped;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 # ABSTRACT: proxy attributes of wrapped methods if their metaclass supports it
 
@@ -30,7 +30,7 @@
 
 =head1 VERSION
 
-version 0.14
+version 0.15
 
 =head1 AUTHORS
 

Modified: branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Method/Wrapped.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Method/Wrapped.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Method/Wrapped.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Method/Wrapped.pm Mon Jul 27 02:02:36 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Role::Meta::Method::Wrapped;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 # ABSTRACT: wrapped metamethod role allowing code attribute introspection
 
@@ -27,7 +27,7 @@
 
 =head1 VERSION
 
-version 0.14
+version 0.15
 
 =head1 METHODS
 

Modified: branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Role.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Role.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Role.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes/Role/Meta/Role.pm Mon Jul 27 02:02:36 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Role::Meta::Role;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 # ABSTRACT: metarole role for storing code attributes
 
@@ -43,8 +43,7 @@
            does_role($thing, 'MooseX::MethodAttributes::Role::Meta::Class')
         && does_role($thing->method_metaclass, 'MooseX::MethodAttributes::Role::Meta::Method')
         && does_role($thing->wrapped_method_metaclass, 'MooseX::MethodAttributes::Role::Meta::Method::MaybeWrapped')) {
-
-            Moose::Util::MetaRole::apply_metaclass_roles(
+            $thing = Moose::Util::MetaRole::apply_metaclass_roles(
                 for_class => $thing->name,
                 metaclass_roles => ['MooseX::MethodAttributes::Role::Meta::Class'],
                 method_metaclass_roles => ['MooseX::MethodAttributes::Role::Meta::Method'],
@@ -56,7 +55,7 @@
         unless (
             does_role( $thing->meta->name, __PACKAGE__ )
         ) {
-            Moose::Util::MetaRole::apply_metaclass_roles(
+            $thing = Moose::Util::MetaRole::apply_metaclass_roles(
                 for_class       => $thing->name,
                 metaclass_roles => [ __PACKAGE__ ],
             );
@@ -70,15 +69,33 @@
     }
 
     # Note that the metaclass instance we started out with may have been turned
-    # into lies by the role application process, so we explicitly re-fetch it
-    # here.
-    my $meta = find_meta($thing->name);
+    # into lies by the metatrait role application process, so we explicitly
+    # re-fetch it here.
 
-    my $ret = $self->$orig($meta);
-    
-    push @{ $meta->_method_attribute_list }, @{ $self->_method_attribute_list };
-    @{ $meta->_method_attribute_map }{ (keys(%{ $self->_method_attribute_map }), keys(%{ $meta->_method_attribute_map })) }
-        = (values(%{ $self->_method_attribute_map }), values(%{ $meta->_method_attribute_map }));
+    # Alternatively, for epic shits and giggles, the meta trait application
+    # process (onto $thing) may have applied roles to our metaclass, but (if
+    # $thing is an anon class, not correctly replaced it in the metaclass cache.
+    # This results in the DESTROY method in Class::MOP::Class r(eap|ape)ing the
+    # package, which is unfortunate, as it removes all your methods and superclasses.
+    # Therefore, we avoid that by ramming the metaclass we've just been handed into
+    # the cache without weakening it.
+
+    # I'm fairly sure the 2nd part of that is a Moose bug, and should go away..
+    # Unfortunately, the implication of that is that whenever you apply roles to a class,
+    # the metaclass instance can change, and so needs to be re-retrieved or handed back
+    # to the caller :/
+    if ($thing->can('is_anon_class') and $thing->is_anon_class) {
+        Class::MOP::store_metaclass_by_name($thing->name, $thing);
+    }
+    else {
+        $thing = find_meta($thing->name);
+    }
+
+    my $ret = $self->$orig($thing);
+
+    push @{ $thing->_method_attribute_list }, @{ $self->_method_attribute_list };
+    @{ $thing->_method_attribute_map }{ (keys(%{ $self->_method_attribute_map }), keys(%{ $thing->_method_attribute_map })) }
+        = (values(%{ $self->_method_attribute_map }), values(%{ $thing->_method_attribute_map }));
 
     return $ret;
 };
@@ -98,12 +115,12 @@
 
 =head1 VERSION
 
-version 0.14
+version 0.15
 
 =head1 SYNOPSIS
 
     package MyRole;
-    use Moose::Role -traits => 'MooseX::MethodAttributes::Role::Meta::Role';
+    use Moose::Role -traits => 'MethodAttributes';
 
     sub foo : Bar Baz('corge') { ... }
 
@@ -121,10 +138,6 @@
 These attributes can then be found later once the methods are composed
 into a class.
 
-Note that currently roles with attributes cannot have methods excluded
-or aliased, and will in turn confer this property onto any roles they
-are composed onto.
-
 =head1 AUTHORS
 
   Florian Ragwitz <rafl at debian.org>
@@ -137,3 +150,21 @@
 This is free software; you can redistribute it and/or modify it under
 the same terms as perl itself.
 
+=head1 CAVEATS
+
+=over 
+
+=item *
+
+Currently roles with attributes cannot have methods excluded
+or aliased, and will in turn confer this property onto any roles they
+are composed onto.
+
+=item *
+
+Composing multiple roles with attributes onto a class at once will fail
+to work as expected, therefore conflict resolution cannot be taken advantage
+of.
+
+=back
+

Modified: branches/upstream/libmoosex-methodattributes-perl/current/t/lib/BaseClass.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/lib/BaseClass.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/BaseClass.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/BaseClass.pm Mon Jul 27 02:02:36 2009
@@ -2,12 +2,12 @@
 use warnings;
 
 package BaseClass::Meta::Role;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 use Moose::Role;
 
 package BaseClass;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 
 use Moose;

Modified: branches/upstream/libmoosex-methodattributes-perl/current/t/lib/ClassUsingRoleWithAttributes.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/lib/ClassUsingRoleWithAttributes.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/ClassUsingRoleWithAttributes.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/ClassUsingRoleWithAttributes.pm Mon Jul 27 02:02:36 2009
@@ -1,5 +1,5 @@
 package ClassUsingRoleWithAttributes;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 use Moose;
 # FIXME - This should not have to be here.

Added: branches/upstream/libmoosex-methodattributes-perl/current/t/lib/OtherRoleWithAttributes.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/lib/OtherRoleWithAttributes.pm?rev=40792&op=file
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/OtherRoleWithAttributes.pm (added)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/OtherRoleWithAttributes.pm Mon Jul 27 02:02:36 2009
@@ -1,0 +1,10 @@
+package OtherRoleWithAttributes;
+our $VERSION = '0.15';
+
+use Moose::Role -traits => 'MethodAttributes';
+use namespace::clean -except => 'meta';
+
+sub bar : AnAttr { 'bar' }
+
+1;
+

Modified: branches/upstream/libmoosex-methodattributes-perl/current/t/lib/OtherSubClass.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/lib/OtherSubClass.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/OtherSubClass.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/OtherSubClass.pm Mon Jul 27 02:02:36 2009
@@ -2,7 +2,7 @@
 use warnings;
 
 package OtherSubClass;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 use base qw/BaseClass/;
 

Modified: branches/upstream/libmoosex-methodattributes-perl/current/t/lib/RoleWithAttributes.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/lib/RoleWithAttributes.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/RoleWithAttributes.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/RoleWithAttributes.pm Mon Jul 27 02:02:36 2009
@@ -1,5 +1,5 @@
 package RoleWithAttributes;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 use Moose::Role -traits => 'MethodAttributes';
 use namespace::clean -except => 'meta';

Modified: branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClass.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClass.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClass.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClass.pm Mon Jul 27 02:02:36 2009
@@ -2,7 +2,7 @@
 use warnings;
 
 package SubClass;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 
 use Moose;

Modified: branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClassUseBaseAndUseMoose.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClassUseBaseAndUseMoose.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClassUseBaseAndUseMoose.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClassUseBaseAndUseMoose.pm Mon Jul 27 02:02:36 2009
@@ -2,7 +2,7 @@
 use warnings;
 
 package SubClassUseBaseAndUseMoose;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 
 use base qw/BaseClass/;

Modified: branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubSubClass.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubSubClass.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubSubClass.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubSubClass.pm Mon Jul 27 02:02:36 2009
@@ -2,7 +2,7 @@
 use warnings;
 
 package SubSubClass;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 
 use base qw/OtherSubClass/;

Modified: branches/upstream/libmoosex-methodattributes-perl/current/t/lib/TestClass.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/lib/TestClass.pm?rev=40792&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/TestClass.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/TestClass.pm Mon Jul 27 02:02:36 2009
@@ -1,5 +1,5 @@
 package TestClass;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 
 use Moose;
@@ -12,7 +12,7 @@
 after foo => sub {};
 
 package SubClass;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 
 use Moose;

Added: branches/upstream/libmoosex-methodattributes-perl/current/t/lib/UsesMultipleRoles.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/lib/UsesMultipleRoles.pm?rev=40792&op=file
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/UsesMultipleRoles.pm (added)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/UsesMultipleRoles.pm Mon Jul 27 02:02:36 2009
@@ -1,0 +1,13 @@
+package UsesMultipleRoles;
+our $VERSION = '0.15';
+
+use Moose;
+use namespace::clean -except => 'meta';
+
+with qw/
+    RoleWithAttributes
+    OtherRoleWithAttributes
+/;
+
+__PACKAGE__->meta->make_immutable;
+

Added: branches/upstream/libmoosex-methodattributes-perl/current/t/multiple_roles.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/multiple_roles.t?rev=40792&op=file
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/multiple_roles.t (added)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/multiple_roles.t Mon Jul 27 02:02:36 2009
@@ -1,0 +1,35 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use FindBin qw/$Bin/;
+use lib "$Bin/lib";
+
+use Test::More tests => 5;
+
+use MooseX::MethodAttributes ();
+
+use UsesMultipleRoles;
+
+my $meta = UsesMultipleRoles->meta;
+
+my $foo = $meta->get_method('foo');
+ok $foo, 'Got foo method';
+
+my $bar = $meta->get_method('bar');
+ok $bar, 'Got bar method';
+
+TODO: {
+    local $TODO = "Does not work yet";
+    SKIP: {
+        ok $meta->can('get_method_attributes')
+            or skip 'Cannot call get_method_attributes method on class', 2;
+
+        my @foo_attrs = $meta->get_method_attributes($foo->body);
+        ok @foo_attrs;
+
+        my @bar_attrs = $meta->get_method_attributes($bar->body);
+        ok @bar_attrs;
+    }
+}
+

Added: branches/upstream/libmoosex-methodattributes-perl/current/t/multiple_roles2.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/multiple_roles2.t?rev=40792&op=file
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/multiple_roles2.t (added)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/multiple_roles2.t Mon Jul 27 02:02:36 2009
@@ -1,0 +1,60 @@
+use strict;
+use warnings;
+use MooseX::MethodAttributes ();
+
+use Test::More tests => 2;
+
+{
+    package Bar;
+    use Moose::Role -traits => 'MethodAttributes';
+    use namespace::clean -except => 'meta';
+
+    sub item :Chained(/app/root) PathPrefix CaptureArgs(1) { }
+}
+
+{
+    package Foo;
+    use Moose::Role -traits => 'MethodAttributes';
+    use namespace::clean -except => 'meta';
+
+    sub live :Chained(item) PathPart Args(0) { }
+    sub foo :Attr { }
+    sub other :Attr { }
+}
+
+{
+    package Catalyst::Controller;
+    use Moose;
+    use namespace::clean -except => 'meta';
+
+    BEGIN { extends qw/MooseX::MethodAttributes::Inheritable/; }
+}
+
+use Moose::Util;
+use Moose::Meta::Class;;
+
+Moose::Meta::Class->create("MyClass",
+    superclasses => [qw/Catalyst::Controller/],
+    roles => ["Bar", "Foo"],
+);
+
+TODO: {
+    local $TODO = 'Does not work yet';
+    SKIP: {
+        ok MyClass->meta->can('get_all_methods_with_attributes')
+            or skip 'Role combination and method attributes known broken', 1;
+
+        my @methods;
+        for my $method (sort { $a->name cmp $b->name } MyClass->meta->get_all_methods_with_attributes) {
+            push(@methods, $method->name . " :" . join("|", @{ $method->attributes }));
+        }
+
+        is_deeply \@methods, [
+            'foo :Attr',
+            'item :Chained(/app/root)|PathPrefix|CaptureArgs(1)',
+            'live :Chained(item)|PathPart|Args(0)',
+            'other :Attr',
+        ], 'methods with expected attributes found';
+    }
+}
+

Added: branches/upstream/libmoosex-methodattributes-perl/current/t/role_with_anon_class.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/role_with_anon_class.t?rev=40792&op=file
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/role_with_anon_class.t (added)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/role_with_anon_class.t Mon Jul 27 02:02:36 2009
@@ -1,0 +1,46 @@
+use strict;
+use warnings;
+use Moose::Util qw/find_meta/;
+use Moose::Meta::Class;
+use MooseX::MethodAttributes ();
+use Test::More tests => 9;
+use MRO::Compat;
+
+{
+    package My::Role;
+    use Moose::Role -traits => 'MethodAttributes';
+
+    sub foo : Bar {}
+}
+{
+    package My::SuperClass;
+    use Moose;
+
+    sub bar {}
+}
+
+my $meta = Moose::Meta::Class->create_anon_class(
+    superclasses => ['My::SuperClass'],
+    roles => ['My::Role'],
+    cache => 1
+);
+
+# FIXME - Note special move here, required
+#         as you get the original metaclass
+#         back, not the one with the roles
+#         appled.
+my $other_meta = find_meta($meta->name);
+
+ok $other_meta;
+my $classname = $other_meta->name;
+isa_ok $classname->new, 'My::SuperClass';
+isa_ok $classname->new, 'Moose::Object';
+my @mro = @{ mro::get_linear_isa($classname) };
+is $mro[1], 'My::SuperClass';
+is $mro[2], 'Moose::Object';
+ok $classname->can('foo');
+ok $classname->can('new');
+ok $classname->can('bar');
+my $attr = $other_meta->get_method_attributes( $classname->can('foo') );
+is_deeply $attr, ['Bar'];
+




More information about the Pkg-perl-cvs-commits mailing list