X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FAttribute.pm;h=e0473a9fb82427b2de90c778f8ef63daa6c38a04;hp=5a43c4d8133c9f00505c651b5d260ffcdff56a28;hb=32af3489ac653966a8ec8df63bec882585c73676;hpb=26eaf09a9d4d6558ca4ee08a803728887ddf9b8a diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 5a43c4d..e0473a9 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -36,7 +36,7 @@ sub type_constraint { $_[0]->{type_constraint} } sub trigger { $_[0]->{trigger} } sub builder { $_[0]->{builder} } sub should_auto_deref { $_[0]->{auto_deref} } -sub is_coerce { $_[0]->{is_coerce} } +sub should_coerce { $_[0]->{should_coerce} } sub has_default { exists $_[0]->{default} } sub has_predicate { exists $_[0]->{predicate} } @@ -61,15 +61,15 @@ sub inlined_name { sub generate_accessor { my $attribute = shift; - my $name = $attribute->name; - my $default = $attribute->default; - my $type = $attribute->type_constraint; - my $constraint = $attribute->find_type_constraint; - my $builder = $attribute->builder; - my $trigger = $attribute->trigger; - my $is_weak = $attribute->is_weak_ref; - my $should_deref = $attribute->should_auto_deref; - my $is_coerce = $attribute->is_coerce; + my $name = $attribute->name; + my $default = $attribute->default; + my $type = $attribute->type_constraint; + my $constraint = $attribute->find_type_constraint; + my $builder = $attribute->builder; + my $trigger = $attribute->trigger; + my $is_weak = $attribute->is_weak_ref; + my $should_deref = $attribute->should_auto_deref; + my $should_coerce = $attribute->should_coerce; my $self = '$_[0]'; my $key = $attribute->inlined_name; @@ -81,7 +81,7 @@ sub generate_accessor { my $value = '$_[1]'; if ($constraint) { - if ($is_coerce) { + if ($should_coerce) { $accessor .= $value.' = $attribute->coerce_constraint('.$value.');'; } $accessor .= 'local $_ = '.$value.';'; @@ -197,7 +197,7 @@ sub create { %args = $self->canonicalize_args($name, %args); $self->validate_args($name, \%args); - $args{is_coerce} = delete $args{coerce} + $args{should_coerce} = delete $args{coerce} if exists $args{coerce}; $args{type_constraint} = delete $args{isa}