X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FMethod%2FConstructor.pm;h=24c845d7f89d75b968b138abc1713d3a6c3b46a4;hb=ccf49e80884ce57511f742a85791d368a372d893;hp=c06a6514d0162a59f935bbaef424f1ec2a963b87;hpb=7701d0aa9144f2376b7e82a345ab377018c35acf;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Method/Constructor.pm b/lib/Moose/Meta/Method/Constructor.pm index c06a651..24c845d 100644 --- a/lib/Moose/Meta/Method/Constructor.pm +++ b/lib/Moose/Meta/Method/Constructor.pm @@ -7,7 +7,7 @@ use warnings; use Carp 'confess'; use Scalar::Util 'blessed', 'weaken', 'looks_like_number'; -our $VERSION = '0.06'; +our $VERSION = '0.05'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Method', @@ -92,9 +92,16 @@ sub intialize_body { # which in turn has attributes which are Class::MOP::Attribute # objects, rather than Moose::Meta::Attribute. And # Class::MOP::Attribute attributes have no type constraints. - my @type_constraints = map { $_->type_constraint } grep { $_->can('type_constraint') } @$attrs; + # However we need to make sure we leave an undef value there + # because the inlined code is using the index of the attributes + # to determine where to find the type constraint + + my @type_constraints = map { + $_->can('type_constraint') ? $_->type_constraint : undef + } @$attrs; + my @type_constraint_bodies = map { - $_ && $_->_compiled_type_constraint; + defined $_ ? $_->_compiled_type_constraint : undef; } @type_constraints; $code = eval $source;