From: Karen Etheridge Date: Tue, 15 Mar 2011 00:16:43 +0000 (-0700) Subject: fix whitespace X-Git-Tag: 0.10~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-UndefTolerant.git;a=commitdiff_plain;h=2dca5fcfeb72f43c830f3af4003f26e9875e524d fix whitespace --- diff --git a/lib/MooseX/UndefTolerant/Constructor.pm b/lib/MooseX/UndefTolerant/Constructor.pm index 969faca..4406f2c 100644 --- a/lib/MooseX/UndefTolerant/Constructor.pm +++ b/lib/MooseX/UndefTolerant/Constructor.pm @@ -2,34 +2,33 @@ package MooseX::UndefTolerant::Constructor; use Moose::Role; if ( $Moose::VERSION < 1.9900 ) { - around('_generate_slot_initializer', sub { - my $orig = shift; - my $self = shift; - - # note the key in the params may not match the attr name. - my $key_name = $self->_attributes->[$_[0]]->init_arg; - - # insert a line of code at the start of the initializer, - # clearing the param if it's undefined. - - if (defined $key_name) - { - # leave the value unscathed if the attribute's type constraint can - # handle undef (or doesn't have one, which implicitly means it can) - my $type_constraint = $self->_attributes->[$_[0]]->type_constraint; - if ($type_constraint and not $type_constraint->check(undef)) - { - my $tolerant_code = - qq# delete \$params->{'$key_name'} unless # . - qq# exists \$params->{'$key_name'} && defined \$params->{'$key_name'};\n#; - - return $tolerant_code . $self->$orig(@_); - } - } - - return $self->$orig(@_); + around('_generate_slot_initializer', sub { + my $orig = shift; + my $self = shift; + + # note the key in the params may not match the attr name. + my $key_name = $self->_attributes->[$_[0]]->init_arg; + + # insert a line of code at the start of the initializer, + # clearing the param if it's undefined. + + if (defined $key_name) + { + # leave the value unscathed if the attribute's type constraint can + # handle undef (or doesn't have one, which implicitly means it can) + my $type_constraint = $self->_attributes->[$_[0]]->type_constraint; + if ($type_constraint and not $type_constraint->check(undef)) + { + my $tolerant_code = + qq# delete \$params->{'$key_name'} unless # . + qq# exists \$params->{'$key_name'} && defined \$params->{'$key_name'};\n#; + + return $tolerant_code . $self->$orig(@_); + } + } + + return $self->$orig(@_); }); no Moose::Role; - 1;