my $attributes = $self->parse_reflect_rules($attr_rules, $attr_haystack);
#create the class
- warn $class;
my $meta = eval { Class::MOP::load_class($class) } ?
$class->meta : $base->meta->create($class, superclasses => [$base]);
my $make_immutable = $meta->is_immutable || $self->make_classes_immutable;
|| ($self->attribute->is_lazy
&& !$self->attribute->is_lazy_fail)
) {
- $self->value($self->model->$reader);
+ my $value = $self->model->$reader;
+ if ( $self->attribute->is_required ) {
+ $self->value($value) if defined $value;
+ }
+ else {
+ $self->value($value);
+ }
}
-
};
};
implements _build_value_string => as {
my $self = shift;
my $meth = $self->value_map_method;
- my $value = $self->value;
+ my $value = $self->has_value ? $self->value : $self->_empty_value;
return blessed($value) ? $value->$meth : $value;
};