r34066 - 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/

eloy at users.alioth.debian.org eloy at users.alioth.debian.org
Sat Apr 25 14:30:18 UTC 2009


Author: eloy
Date: Sat Apr 25 14:30:13 2009
New Revision: 34066

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

Added:
    branches/upstream/libmoosex-methodattributes-perl/current/t/calling.t
    branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClassUseBaseAndUseMoose.pm
    branches/upstream/libmoosex-methodattributes-perl/current/t/override_method_with_no_attribute.t
Removed:
    branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClassMoosed.pm
Modified:
    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/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/t/inherited.t
    branches/upstream/libmoosex-methodattributes-perl/current/t/lib/BaseClass.pm
    branches/upstream/libmoosex-methodattributes-perl/current/t/lib/OtherSubClass.pm
    branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClass.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/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/MANIFEST?rev=34066&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/MANIFEST (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/MANIFEST Sat Apr 25 14:30:13 2009
@@ -14,11 +14,13 @@
 lib/MooseX/MethodAttributes/Role/Meta/Method/MaybeWrapped.pm
 lib/MooseX/MethodAttributes/Role/Meta/Method/Wrapped.pm
 t/basic.t
+t/calling.t
 t/inherited.t
 t/inherited_non_moose_multilevel.t
 t/lib/BaseClass.pm
 t/lib/OtherSubClass.pm
 t/lib/SubClass.pm
-t/lib/SubClassMoosed.pm
+t/lib/SubClassUseBaseAndUseMoose.pm
 t/lib/SubSubClass.pm
-t/lib/TestClass.pm
+t/lib/TestClass.pm
+t/override_method_with_no_attribute.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=34066&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/META.yml (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/META.yml Sat Apr 25 14:30:13 2009
@@ -3,11 +3,11 @@
 author: 
   - Florian Ragwitz <rafl at debian.org>
   - Tomas Doran <bobtfish at bobtfish.net>
-generated_by: Dist::Zilla::Plugin::MetaYaml version 1.006
+generated_by: Dist::Zilla::Plugin::MetaYaml version 1.004
 license: perl
 name: MooseX-MethodAttributes
 requires: 
   Moose: 0.70
   MooseX::Types: 0.06
   namespace::clean: 0
-version: 0.06
+version: 0.07

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=34066&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/Makefile.PL (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/Makefile.PL Sat Apr 25 14:30:13 2009
@@ -9,7 +9,7 @@
   NAME      => 'MooseX::MethodAttributes',
   AUTHOR    => 'Florian\ Ragwitz\ \<rafl\@debian\.org\>\,\ Tomas\ Doran\ \<bobtfish\@bobtfish\.net\>',
   ABSTRACT  => 'code attribute introspection',
-  VERSION   => '0.06',
+  VERSION   => '0.07',
   EXE_FILES => [ qw() ],
   (eval { ExtUtils::MakeMaker->VERSION(6.21) } ? (LICENSE => 'perl') : ()),
   PREREQ_PM    => {

Modified: branches/upstream/libmoosex-methodattributes-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/README?rev=34066&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/README (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/README Sat Apr 25 14:30:13 2009
@@ -1,7 +1,7 @@
 
 
 This archive contains the distribution MooseX-MethodAttributes, version
-0.06:
+0.07:
 
   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=34066&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/dist.ini (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/dist.ini Sat Apr 25 14:30:13 2009
@@ -1,5 +1,5 @@
 name    = MooseX-MethodAttributes
-version = 0.06
+version = 0.07
 author  = Florian Ragwitz <rafl at debian.org>
 author  = Tomas Doran <bobtfish at bobtfish.net>
 license = Perl_5

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=34066&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/lib/MooseX/MethodAttributes.pm Sat Apr 25 14:30:13 2009
@@ -2,7 +2,7 @@
 use warnings;
 
 package MooseX::MethodAttributes;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 # ABSTRACT: code attribute introspection
 
@@ -38,7 +38,7 @@
 
 =head1 VERSION
 
-version 0.06
+version 0.07
 
 =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=34066&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 Sat Apr 25 14:30:13 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Inheritable;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 # ABSTRACT: inheritable code attribute introspection
 
@@ -21,7 +21,7 @@
 
 =head1 VERSION
 
-version 0.06
+version 0.07
 
 =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=34066&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 Sat Apr 25 14:30:13 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Role::AttrContainer;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 # ABSTRACT: capture code attributes in the class' metaclass
 
@@ -24,7 +24,7 @@
 
 =head1 VERSION
 
-version 0.06
+version 0.07
 
 =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=34066&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 Sat Apr 25 14:30:13 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Role::AttrContainer::Inheritable;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 # ABSTRACT: capture code attributes in the automatically initialized metaclass instance
 
@@ -39,7 +39,7 @@
 
 =head1 VERSION
 
-version 0.06
+version 0.07
 
 =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=34066&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 Sat Apr 25 14:30:13 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Role::Meta::Class;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 # ABSTRACT: metaclass role for storing code attributes
 
@@ -34,7 +34,7 @@
 
 sub get_method_attributes {
     my ($self, $code) = @_;
-    return $self->_method_attribute_map->{ 0 + $code };
+    return $self->_method_attribute_map->{ 0 + $code } || [];
 }
 
 
@@ -76,7 +76,17 @@
     } reverse $self->linearized_isa
 }
 
+
+sub get_nearest_methods_with_attributes {
+    my ($self) = @_;
+    
+    grep { 
+        scalar @{ $self->find_method_by_name($_->name)->attributes }
+    } $self->get_all_methods_with_attributes;
+}
+
 1;
+
 
 __END__
 =head1 NAME
@@ -85,7 +95,7 @@
 
 =head1 VERSION
 
-version 0.06
+version 0.07
 
 =head1 METHODS
 
@@ -114,6 +124,28 @@
 that have attributes. Baseclass methods come before subclass methods. Methods
 of one class have the order they have been declared in.
 
+
+
+=head2 get_nearest_methods_with_attributes
+
+The same as get_all_methods_with_attributes, except that methods from parent classes
+are not included if there is an attributeless method in a child class.
+
+For example, given:
+
+    package BaseClass;
+
+    sub foo : Attr {}
+
+    package SubClass;
+    use base qw/BaseClass/;
+
+    sub foo {}
+
+C<< SubClass->meta->get_all_methods_with_attributes >> will return 
+C<< BaseClass->meta->get_method('foo') >> for the above example, but
+this method will not.
+
 =head1 AUTHORS
 
   Florian Ragwitz <rafl at debian.org>

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=34066&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 Sat Apr 25 14:30:13 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Role::Meta::Method;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 # ABSTRACT: metamethod role allowing code attribute introspection
 
@@ -34,7 +34,7 @@
 
 =head1 VERSION
 
-version 0.06
+version 0.07
 
 =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=34066&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 Sat Apr 25 14:30:13 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Role::Meta::Method::MaybeWrapped;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 # ABSTRACT: proxy attributes of wrapped methods if their metaclass supports it
 
@@ -26,7 +26,7 @@
 
 =head1 VERSION
 
-version 0.06
+version 0.07
 
 =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=34066&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 Sat Apr 25 14:30:13 2009
@@ -1,5 +1,5 @@
 package MooseX::MethodAttributes::Role::Meta::Method::Wrapped;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 # ABSTRACT: wrapped metamethod role allowing code attribute introspection
 
@@ -27,7 +27,7 @@
 
 =head1 VERSION
 
-version 0.06
+version 0.07
 
 =head1 METHODS
 

Added: branches/upstream/libmoosex-methodattributes-perl/current/t/calling.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/calling.t?rev=34066&op=file
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/calling.t (added)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/calling.t Sat Apr 25 14:30:13 2009
@@ -1,0 +1,17 @@
+use strict;
+use warnings;
+use FindBin qw/$Bin/;
+use lib "$Bin/lib";
+
+use Test::More tests => 3;
+
+use BaseClass;
+use SubClass;
+
+BaseClass->affe;
+is(BaseClass::no_calls_to_affe(), 1);
+
+SubClass->affe;
+is(BaseClass::no_calls_to_affe(), 2);
+is(SubClass::no_calls_to_affe(), 1);
+

Modified: branches/upstream/libmoosex-methodattributes-perl/current/t/inherited.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/inherited.t?rev=34066&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/inherited.t (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/inherited.t Sat Apr 25 14:30:13 2009
@@ -8,10 +8,10 @@
 use Moose::Util qw/does_role/;
 
 BEGIN { use_ok 'SubClass'; }
-BEGIN { use_ok 'SubClassMoosed'; }
+BEGIN { use_ok 'SubClassUseBaseAndUseMoose'; }
 
 my $meta = SubClass->meta;
-my $meta2 = SubClassMoosed->meta;
+my $meta2 = SubClassUseBaseAndUseMoose->meta;
 
 ok( does_role(
         BaseClass->meta->method_metaclass
@@ -26,7 +26,7 @@
 ok( does_role(
         $meta2->method_metaclass
         => 'MooseX::MethodAttributes::Role::Meta::Method'
-    ) => 'SubClassMoosed does method meta role'
+    ) => 'SubClassUseBaseAndUseMoose does method meta role'
 );
 
 is_deeply(

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=34066&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/BaseClass.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/BaseClass.pm Sat Apr 25 14:30:13 2009
@@ -2,12 +2,12 @@
 use warnings;
 
 package BaseClass::Meta::Role;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 use Moose::Role;
 
 package BaseClass;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 
 use Moose;
@@ -23,7 +23,14 @@
 
 sub moo : Moo {}
 
-sub affe : Birne {}
+{
+    my $affe_was_run = 0;
+
+    sub affe : Birne { $affe_was_run++; }
+
+    sub no_calls_to_affe { $affe_was_run }
+
+}
 
 sub foo : Foo {}
 

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=34066&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/OtherSubClass.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/OtherSubClass.pm Sat Apr 25 14:30:13 2009
@@ -2,7 +2,7 @@
 use warnings;
 
 package OtherSubClass;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 use base qw/BaseClass/;
 

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=34066&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClass.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClass.pm Sat Apr 25 14:30:13 2009
@@ -2,7 +2,7 @@
 use warnings;
 
 package SubClass;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 
 use Moose;
@@ -10,7 +10,17 @@
 
 sub bar : Bar {}
 
-before affe => sub {};
+{
+    my $no_calls_to_affe = 0;
+
+    before affe => sub {
+        $no_calls_to_affe++;
+    };
+
+    sub no_calls_to_affe {
+        $no_calls_to_affe;
+    }
+}
 no Moose;
 
 1;

Added: 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=34066&op=file
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClassUseBaseAndUseMoose.pm (added)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubClassUseBaseAndUseMoose.pm Sat Apr 25 14:30:13 2009
@@ -1,0 +1,17 @@
+use strict;
+use warnings;
+
+package SubClassUseBaseAndUseMoose;
+our $VERSION = '0.07';
+
+
+use base qw/BaseClass/;
+
+use Moose;
+
+sub bar : Bar {}
+
+before affe => sub {};
+no Moose;
+
+1;

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=34066&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubSubClass.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/SubSubClass.pm Sat Apr 25 14:30:13 2009
@@ -2,7 +2,7 @@
 use warnings;
 
 package SubSubClass;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 
 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=34066&op=diff
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/lib/TestClass.pm (original)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/lib/TestClass.pm Sat Apr 25 14:30:13 2009
@@ -1,5 +1,5 @@
 package TestClass;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 
 use Moose;
@@ -7,10 +7,12 @@
 
 sub foo : SomeAttribute AnotherAttribute('with argument') {}
 
+sub bar : SomeAttribute {}
+
 after foo => sub {};
 
 package SubClass;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 
 use Moose;
@@ -20,4 +22,6 @@
 
 sub foo : Attributes Attributes Attributes {}
 
+sub bar {}  # no attribute!
+
 1;

Added: branches/upstream/libmoosex-methodattributes-perl/current/t/override_method_with_no_attribute.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-methodattributes-perl/current/t/override_method_with_no_attribute.t?rev=34066&op=file
==============================================================================
--- branches/upstream/libmoosex-methodattributes-perl/current/t/override_method_with_no_attribute.t (added)
+++ branches/upstream/libmoosex-methodattributes-perl/current/t/override_method_with_no_attribute.t Sat Apr 25 14:30:13 2009
@@ -1,0 +1,30 @@
+use strict;
+use warnings;
+use Test::More tests => 7;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use TestClass;
+
+is_deeply( TestClass->meta->get_method('bar')->attributes,
+    [q{SomeAttribute}], );
+
+is_deeply( SubClass->meta->get_method('bar')->attributes, [], );
+
+my @methods = SubClass->meta->get_all_methods_with_attributes;
+
+my $bar_method = (grep { $_->name eq 'bar' } @methods)[0];
+ok $bar_method;
+
+# This is correct, we get the bar method from TestClass back,
+# as that is the one with attributes.
+isnt $bar_method, SubClass->meta->get_method('bar');
+is $bar_method, TestClass->meta->get_method('bar');
+
+my @methods_filtered = SubClass->meta->get_nearest_methods_with_attributes;
+is( scalar(@methods_filtered), (scalar(@methods)-1) );
+
+my $no_bar_method = (grep { $_->name eq 'bar' } @methods_filtered)[0]; 
+is $no_bar_method, undef;
+




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