X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FAttribute.pm;h=c6e4abfca4547b954c0283adbf61fe5eaca5b28e;hb=7a5ebc4095c54b0420df515494e32acafbd5fcf0;hp=7bd0bbedcc83012f41198b2a96bcf8a844dac818;hpb=ab859145de2d6d4a7c67f7281974bac0bc79bc68;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 7bd0bbe..c6e4abf 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -226,7 +226,7 @@ sub initialize_instance_slot { $val = $self->default($instance); } - if (defined $val) { + if (defined $val || $self->has_default) { if ($self->has_type_constraint) { my $type_constraint = $self->type_constraint; if ($self->should_coerce && $type_constraint->has_coercion) { @@ -237,7 +237,7 @@ sub initialize_instance_slot { $self->name . ") does not pass the type constraint (" . $type_constraint->name . - ") with '$val'"; + ") with '" . (defined $val ? $val : 'undef') . "'"; } }