From: Karen Etheridge Date: Tue, 27 Jul 2010 22:10:57 +0000 (-0700) Subject: update Moose::Exporter calls for post-0.93 Moose API (RT#59744) X-Git-Tag: 0.06~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e307e391921ca301d84e6c57f569beb44d7dbb98;p=gitmo%2FMooseX-AlwaysCoerce.git update Moose::Exporter calls for post-0.93 Moose API (RT#59744) --- diff --git a/Changes b/Changes index 1d2093c..7d3bf8d 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for MooseX-AlwaysCoerce + - Use modern Moose APIs, to avoid warnings with Moose 1.09 (Karen Etheridge) + 0.05 2010-07-13 00:05:10 - support types without coercion (Schwern) diff --git a/lib/MooseX/AlwaysCoerce.pm b/lib/MooseX/AlwaysCoerce.pm index 3fbfd59..240dff5 100644 --- a/lib/MooseX/AlwaysCoerce.pm +++ b/lib/MooseX/AlwaysCoerce.pm @@ -81,22 +81,22 @@ Use C<< coerce => 0 >> to disable a coercion explicitly. }; } +my (undef, undef, $init_meta) = Moose::Exporter->build_import_methods( + install => [ qw(import unimport) ], + class_metaroles => { + attribute => ['MooseX::AlwaysCoerce::Role::Meta::Attribute'], + class => ['MooseX::AlwaysCoerce::Role::Meta::Class'], + }, +); + sub init_meta { - shift; - my %options = @_; + my ($class, %options) = @_; my $for_class = $options{for_class}; MooseX::ClassAttribute->import({ into => $for_class }); - Moose::Util::MetaRole::apply_metaclass_roles( - for_class => $for_class, - attribute_metaclass_roles => - ['MooseX::AlwaysCoerce::Role::Meta::Attribute'], - metaclass_roles => - ['MooseX::AlwaysCoerce::Role::Meta::Class'], - ); - - return $for_class->meta; + # call generated method to do the rest of the work. + goto $init_meta; } =head1 AUTHOR @@ -106,6 +106,7 @@ Rafael Kitover, C<< >> =head1 CONTRIBUTORS Schwern: Michael G. Schwern +Ether: Karen Etheridge =head1 BUGS