X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-UndefTolerant.git;a=blobdiff_plain;f=lib%2FMooseX%2FUndefTolerant%2FAttribute.pm;h=644611edcfd8c7379f2930f48209855511dbb816;hp=9caabc722bac7ceee55013944c8268d7fa523e2d;hb=0601096cb90ce43aa10165078a330de93c71e4ca;hpb=95f919704c988799ad0eca0b012fcc2a75ee69b6 diff --git a/lib/MooseX/UndefTolerant/Attribute.pm b/lib/MooseX/UndefTolerant/Attribute.pm index 9caabc7..644611e 100644 --- a/lib/MooseX/UndefTolerant/Attribute.pm +++ b/lib/MooseX/UndefTolerant/Attribute.pm @@ -11,7 +11,7 @@ around('initialize_instance_slot', sub { # If our parameter passed in was undef, remove it from the parameter list... # but leave the value unscathed if the attribute's type constraint can # handle undef (or doesn't have one, which implicitly means it can) - if (not defined $key_name or not defined($params->{$key_name})) + if (defined $key_name and not defined($params->{$key_name})) { my $type_constraint = $self->type_constraint; if ($type_constraint and not $type_constraint->check(undef)) @@ -20,7 +20,7 @@ around('initialize_instance_slot', sub { } } - # Invoke the real init, as the above line cleared the undef + # Invoke the real init, as the above line cleared the undef param value $self->$orig(@_) });