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} }
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;
my $value = '$_[1]';
if ($constraint) {
- if ($is_coerce) {
+ if ($should_coerce) {
$accessor .= $value.' = $attribute->coerce_constraint('.$value.');';
}
$accessor .= 'local $_ = '.$value.';';
%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}
if (defined($from) && exists($args->{$from})) {
$args->{$from} = $attribute->coerce_constraint($args->{$from})
- if $attribute->is_coerce;
+ if $attribute->should_coerce;
$attribute->verify_type_constraint($args->{$from})
if $attribute->has_type_constraint;
: $default;
$value = $attribute->coerce_constraint($value)
- if $attribute->is_coerce;
+ if $attribute->should_coerce;
$attribute->verify_type_constraint($value)
if $attribute->has_type_constraint;