X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-SemiAffordanceAccessor.git;a=blobdiff_plain;f=lib%2FMooseX%2FSemiAffordanceAccessor.pm;h=dac4a6d4de013b62a9a849e0ed55a9a0b50d8239;hp=e951a5fa490bc9e5bd4459b1eeba27f474f5325b;hb=f33c93c5b1cb83f06213e39eb285ab9373fba10c;hpb=1a0388e60be432cf142e7026d91c197a7d7fd68c diff --git a/lib/MooseX/SemiAffordanceAccessor.pm b/lib/MooseX/SemiAffordanceAccessor.pm index e951a5f..dac4a6d 100644 --- a/lib/MooseX/SemiAffordanceAccessor.pm +++ b/lib/MooseX/SemiAffordanceAccessor.pm @@ -3,48 +3,35 @@ package MooseX::SemiAffordanceAccessor; use strict; use warnings; -our $VERSION = '0.03'; - -use Moose 0.5504 (); +use Moose 0.94 (); use Moose::Exporter; use Moose::Util::MetaRole; use MooseX::SemiAffordanceAccessor::Role::Attribute; -# The main reason to use this is to ensure that we get the right value -# in $p{for_class} later. -Moose::Exporter->setup_import_methods(); - - -sub init_meta -{ - shift; - my %p = @_; - - Moose->init_meta(%p); +my %metaroles = ( + class_metaroles => { + attribute => ['MooseX::SemiAffordanceAccessor::Role::Attribute'], + }, +); - return - Moose::Util::MetaRole::apply_metaclass_roles - ( for_class => $p{for_class}, - attribute_metaclass_roles => - ['MooseX::SemiAffordanceAccessor::Role::Attribute'], - ); -} +$metaroles{role_metaroles} = { + applied_attribute => ['MooseX::SemiAffordanceAccessor::Role::Attribute'], +} if $Moose::VERSION >= 1.9900; +Moose::Exporter->setup_import_methods(%metaroles); 1; +# ABSTRACT: Name your accessors foo() and set_foo() + __END__ =pod -=head1 NAME - -MooseX::SemiAffordanceAccessor - Name your accessors foo() and set_foo() - =head1 SYNOPSIS - use MooseX::SemiAffordanceAccessor; use Moose; + use MooseX::SemiAffordanceAccessor; # make some attributes @@ -64,9 +51,18 @@ attribute, then that attribute's naming scheme is left unchanged. The name "semi-affordance" comes from David Wheeler's Class::Meta module. -=head1 AUTHOR +=head1 ACCESSORS IN ROLES + +Prior to version 1.9900 of L, attributes added to a class ended up with +that class's attribute traits. That means that if your class used +C, any attributes provided by roles you +consumed had the semi-affordance style of accessor. -Dave Rolsky, C<< >> +As of Moose 1.9900, that is no longer the case. Attributes provided by roles +no longer acquire the consuming class's attribute traits. However, with Moose +1.9900+, you can now use C directly in +roles. Attributes defined by that role will have semi-affordance style +accessors, regardless of what attribute traits the consuming class has. =head1 BUGS @@ -76,11 +72,4 @@ the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. -=head1 COPYRIGHT & LICENSE - -Copyright 2007 Dave Rolsky, All Rights Reserved. - -This program is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. - =cut