From: t0m Date: Sun, 5 Jul 2009 23:42:13 +0000 (+0100) Subject: Fix warnings in latest Moose X-Git-Tag: 0.00901~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Emulate-Class-Accessor-Fast.git;a=commitdiff_plain;h=69462673550d69e65a39c49327fcdd17f6f2b715 Fix warnings in latest Moose --- diff --git a/Changes b/Changes index a651002..223eed2 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ + - Fix to not warn with newer versions of Moose by passing is => 'bare' + to process_accessors method. + 0.00900 May 29, 2009 - Fix so that classes which implement BUILD themselves still get all attributes passed to their constuctor placed into the instance diff --git a/lib/MooseX/Emulate/Class/Accessor/Fast.pm b/lib/MooseX/Emulate/Class/Accessor/Fast.pm index 29cae87..57d3f81 100644 --- a/lib/MooseX/Emulate/Class/Accessor/Fast.pm +++ b/lib/MooseX/Emulate/Class/Accessor/Fast.pm @@ -115,7 +115,7 @@ sub mk_accessors { #dont overwrite existing methods if($reader eq $writer){ - my %opts = ( $meta->has_method($reader) ? () : (accessor => $reader) ); + my %opts = ( $meta->has_method($reader) ? ( is => 'bare' ) : (accessor => $reader) ); my $attr = $meta->find_attribute_by_name($attr_name) || $meta->add_attribute($attr_name, %opts, traits => ['MooseX::Emulate::Class::Accessor::Fast::Meta::Role::Attribute'] ); @@ -151,7 +151,7 @@ sub mk_ro_accessors { $meta->remove_attribute($attr_name) if $meta->find_attribute_by_name($attr_name); my $reader = $self->accessor_name_for($attr_name); - my @opts = ($meta->has_method($reader) ? () : (reader => $reader) ); + my @opts = ($meta->has_method($reader) ? (is => 'bare') : (reader => $reader) ); my $attr = $meta->add_attribute($attr_name, @opts, traits => ['MooseX::Emulate::Class::Accessor::Fast::Meta::Role::Attribute'] ) if scalar(@opts); @@ -263,7 +263,8 @@ sub make_accessor { my($class, $field) = @_; my $meta = $locate_metaclass->($class); my $attr = $meta->find_attribute_by_name($field) || $meta->add_attribute($field, - traits => ['MooseX::Emulate::Class::Accessor::Fast::Meta::Role::Attribute'] + traits => ['MooseX::Emulate::Class::Accessor::Fast::Meta::Role::Attribute'], + is => 'bare', ); my $reader = $attr->get_read_method_ref; my $writer = $attr->get_write_method_ref; @@ -279,7 +280,8 @@ sub make_ro_accessor { my($class, $field) = @_; my $meta = $locate_metaclass->($class); my $attr = $meta->find_attribute_by_name($field) || $meta->add_attribute($field, - traits => ['MooseX::Emulate::Class::Accessor::Fast::Meta::Role::Attribute'] + traits => ['MooseX::Emulate::Class::Accessor::Fast::Meta::Role::Attribute'], + is => 'bare', ); return $attr->get_read_method_ref; } @@ -289,7 +291,8 @@ sub make_wo_accessor { my($class, $field) = @_; my $meta = $locate_metaclass->($class); my $attr = $meta->find_attribute_by_name($field) || $meta->add_attribute($field, - traits => ['MooseX::Emulate::Class::Accessor::Fast::Meta::Role::Attribute'] + traits => ['MooseX::Emulate::Class::Accessor::Fast::Meta::Role::Attribute'], + is => 'bare', ); return $attr->get_write_method_ref; }