From: Shawn M Moore Date: Fri, 10 Jul 2009 05:47:32 +0000 (-0400) Subject: Exporter/MetaRole X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4db16c58db34a7f8beb429e13ccf879ba2c86dd3;p=gitmo%2FMooseX-IsDefaults.git Exporter/MetaRole --- diff --git a/lib/MooseX/IsDefaults/RO.pm b/lib/MooseX/IsDefaults/RO.pm new file mode 100644 index 0000000..a6561f5 --- /dev/null +++ b/lib/MooseX/IsDefaults/RO.pm @@ -0,0 +1,25 @@ +package MooseX::IsDefaults::RO; +use Moose (); +use Moose::Exporter; +use Moose::Util::MetaRole; + +use MooseX::IsDefaults::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::IsDefaults::Meta::IsRO'], + ); + + return $options{for_class}->meta; +} + +1; +