From: Shawn M Moore Date: Sat, 24 Jul 2010 03:57:52 +0000 (-0400) Subject: Use the shiny new Moose::Exporter API X-Git-Tag: 0.03~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=902692e5da3f2ee913f796e007c430cceefbe7f8;p=gitmo%2FMooseX-HasDefaults.git Use the shiny new Moose::Exporter API --- diff --git a/lib/MooseX/HasDefaults/RO.pm b/lib/MooseX/HasDefaults/RO.pm index bde3acb..1ffc65c 100644 --- a/lib/MooseX/HasDefaults/RO.pm +++ b/lib/MooseX/HasDefaults/RO.pm @@ -5,21 +5,12 @@ use Moose::Util::MetaRole; use MooseX::HasDefaults::Meta::IsRO; -Moose::Exporter->setup_import_methods(also => 'Moose'); - -sub init_meta { - shift; - my %options = @_; - - Moose->init_meta(%options); - - Moose::Util::MetaRole::apply_metaclass_roles( - for_class => $options{for_class}, - attribute_metaclass_roles => ['MooseX::HasDefaults::Meta::IsRO'], - ); - - return $options{for_class}->meta; -} +Moose::Exporter->setup_import_methods( + also => 'Moose', + class_metaroles => { + attribute => ['MooseX::HasDefaults::Meta::IsRO'], + }, +); 1; diff --git a/lib/MooseX/HasDefaults/RW.pm b/lib/MooseX/HasDefaults/RW.pm index c4c3a95..b87c704 100644 --- a/lib/MooseX/HasDefaults/RW.pm +++ b/lib/MooseX/HasDefaults/RW.pm @@ -5,21 +5,12 @@ use Moose::Util::MetaRole; use MooseX::HasDefaults::Meta::IsRW; -Moose::Exporter->setup_import_methods(also => 'Moose'); - -sub init_meta { - shift; - my %options = @_; - - Moose->init_meta(%options); - - Moose::Util::MetaRole::apply_metaclass_roles( - for_class => $options{for_class}, - attribute_metaclass_roles => ['MooseX::HasDefaults::Meta::IsRW'], - ); - - return $options{for_class}->meta; -} +Moose::Exporter->setup_import_methods( + also => 'Moose', + class_metaroles => { + attribute => ['MooseX::HasDefaults::Meta::IsRW'], + }, +); 1;