From: Jesse Luehrs Date: Sat, 9 Oct 2010 20:42:26 +0000 (-0500) Subject: add applied_attribute metarole X-Git-Tag: v0.05~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-FollowPBP.git;a=commitdiff_plain;h=097c939028f5fc12eec2597c87b17798474f7dc3;hp=b2d351224e581deb1e7ef954f1f6e4cf604f2677 add applied_attribute metarole --- diff --git a/Changes b/Changes index 4f435ce..154d50b 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ +- Allow MooseX::FollowPBP to be used in roles. + 0.04 2010-07-20 - Respect "is => 'bare'" attributes. diff --git a/dist.ini b/dist.ini index ddb99e0..c0bad70 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/FollowPBP.pm b/lib/MooseX/FollowPBP.pm index 9e29256..e19c904 100644 --- a/lib/MooseX/FollowPBP.pm +++ b/lib/MooseX/FollowPBP.pm @@ -12,6 +12,9 @@ Moose::Exporter->setup_import_methods( class_metaroles => { attribute => ['MooseX::FollowPBP::Role::Attribute'], }, + role_metaroles => { + applied_attribute => ['MooseX::FollowPBP::Role::Attribute'], + }, ); 1; diff --git a/t/basic.t b/t/basic.t index c14d332..8f6c1ca 100644 --- a/t/basic.t +++ b/t/basic.t @@ -64,4 +64,21 @@ ok( ! PBP3->can('set_thing2'), 'PBP3->set_thing2 does not exist' ); ok( !PBP4->can('get_bare'), 'is => bare attribute is respected' ); ok( !PBP4->can('set_bare'), 'is => bare attribute is respected' ); +{ + package PBP::Role; + use Moose::Role; + use MooseX::FollowPBP; + has foo => (is => 'rw'); +} + +{ + package PBP::WithRole; + use Moose; + with 'PBP::Role'; +} + +ok( PBP::WithRole->can('get_foo'), "works in a role" ); +ok( PBP::WithRole->can('set_foo'), "works in a role" ); +ok( !PBP::WithRole->can('foo'), "works in a role" ); + done_testing();