From: Stevan Little Date: Tue, 21 Mar 2006 20:17:51 +0000 (+0000) Subject: whoops X-Git-Tag: 0_05~66 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8339fae27b21432891dd83b9cbd97ae1928c75d8;p=gitmo%2FMoose.git whoops --- diff --git a/Changes b/Changes index cdd93d8..1c8ba4a 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ Revision history for Perl extension Moose +0.03 + * Moose::Meta::Class + - fixed the way attribute defaults are handled + during instance construction (bug found by chansen) + 0.02 Tues. March 21, 2006 * Moose - many more tests, fixing some bugs and diff --git a/README b/README index 46cd84c..50da87b 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Moose version 0.02 +Moose version 0.03 =========================== See the individual module documentation for more information diff --git a/lib/Moose.pm b/lib/Moose.pm index 0723860..b7430cf 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -4,7 +4,7 @@ package Moose; use strict; use warnings; -our $VERSION = '0.02'; +our $VERSION = '0.03'; use Scalar::Util 'blessed', 'reftype'; use Carp 'confess'; diff --git a/lib/Moose/Meta/Class.pm b/lib/Moose/Meta/Class.pm index a6fa937..5d2d046 100644 --- a/lib/Moose/Meta/Class.pm +++ b/lib/Moose/Meta/Class.pm @@ -7,7 +7,7 @@ use warnings; use Carp 'confess'; use Scalar::Util 'weaken'; -our $VERSION = '0.02'; +our $VERSION = '0.03'; use base 'Class::MOP::Class'; @@ -21,7 +21,9 @@ sub construct_instance { $val = $params{$init_arg} if exists $params{$init_arg}; # if nothing was in the %params, we can use the # attribute's default value (if it has one) - $val ||= $attr->default($instance) if $attr->has_default; + if (!defined $val && $attr->has_default) { + $val = $attr->default($instance); + } if (defined $val) { if ($attr->has_type_constraint) { if ($attr->should_coerce && $attr->type_constraint->has_coercion) {