From: Jesse Luehrs Date: Sat, 9 Oct 2010 20:50:27 +0000 (-0500) Subject: add applied_attribute metarole X-Git-Tag: v0.09~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=080d1e6df9e616302eb2294b6767a5676cba8c82;p=gitmo%2FMooseX-SemiAffordanceAccessor.git add applied_attribute metarole --- diff --git a/Changes b/Changes index 1c77210..31e9e55 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ +- Allow MooseX::SemiAffordanceAccessor to be used in roles. + 0.08 2010-07-20 - Fix a bad example in the SYNOPSIS. diff --git a/dist.ini b/dist.ini index d49b7bb..d5ccb3a 100644 --- a/dist.ini +++ b/dist.ini @@ -29,7 +29,7 @@ repository.type = git [CheckChangeLog] [Prereqs] -Moose = 0.94 +Moose = 1.16 [Prereqs / TestRequires] Test::More = 0.88 diff --git a/lib/MooseX/SemiAffordanceAccessor.pm b/lib/MooseX/SemiAffordanceAccessor.pm index b3b40b8..f1a5834 100644 --- a/lib/MooseX/SemiAffordanceAccessor.pm +++ b/lib/MooseX/SemiAffordanceAccessor.pm @@ -12,6 +12,9 @@ Moose::Exporter->setup_import_methods( class_metaroles => { attribute => ['MooseX::SemiAffordanceAccessor::Role::Attribute'], }, + role_metaroles => { + applied_attribute => ['MooseX::SemiAffordanceAccessor::Role::Attribute'], + }, ); 1; diff --git a/t/basic.t b/t/basic.t index 520561c..dc5c65f 100644 --- a/t/basic.t +++ b/t/basic.t @@ -68,4 +68,20 @@ ok( SAA3->can('set_it'), 'SAA3->set_it does exist' ); ok( !SAA4->can('bare'), 'SAA4->bare does not exist' ); ok( !SAA4->can('set_bare'), 'SAA4->set_bare does not exist' ); +{ + package SAA::Role; + use Moose::Role; + use MooseX::SemiAffordanceAccessor; + has foo => (is => 'rw'); +} + +{ + package SAA::WithRole; + use Moose; + with 'SAA::Role'; +} + +ok( SAA::WithRole->can('foo'), "roles work" ); +ok( SAA::WithRole->can('set_foo'), "roles work" ); + done_testing();