X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FMethod%2FConstructor.pm;h=430679d9ac876e59a7923e2027da598a76b7d853;hb=6336eb18ec59cf5c9c057624c7a1d15f449b00c6;hp=f5722d38978d2628626d0c4b695e6e9c92e75d52;hpb=1746908e63ce233fad3c290d731ac34aff7c2d22;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Meta/Method/Constructor.pm b/lib/Mouse/Meta/Method/Constructor.pm index f5722d3..430679d 100644 --- a/lib/Mouse/Meta/Method/Constructor.pm +++ b/lib/Mouse/Meta/Method/Constructor.pm @@ -87,10 +87,6 @@ sub _generate_initialize_object { $post_process .= "\$checks[$index]->($instance_slot)\n"; $post_process .= " or $attr_var->_throw_type_constraint_error($instance_slot, $constraint_var);\n"; } - if($is_weak_ref){ - $post_process = "Scalar::Util::weaken($instance_slot) " - . "if ref $instance_slot;\n"; - } # build cde for an attribute if (defined $init_arg) { @@ -151,6 +147,11 @@ sub _generate_initialize_object { $code .= "}\n" if defined $init_arg; + if($is_weak_ref){ + $code .= "Scalar::Util::weaken($instance_slot) " + . "if ref $instance_slot;\n"; + } + push @res, $code; } @@ -232,7 +233,7 @@ Mouse::Meta::Method::Constructor - A Mouse method generator for constructors =head1 VERSION -This document describes Mouse version 0.85 +This document describes Mouse version 0.93 =head1 SEE ALSO