From: Shawn M Moore Date: Fri, 5 Dec 2008 01:25:33 +0000 (+0000) Subject: Fix for default in a constructor reported and tested by rjbs :) X-Git-Tag: 0.19~138 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=a9d1cb9d89e107f2869022db91be07cea5dccc4f;hp=de51e718045222d06aebbb34cc943927008a5512 Fix for default in a constructor reported and tested by rjbs :) --- diff --git a/Changes b/Changes index d167e55..961cad7 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Revision history for Mouse 0.13 + * Pass in the instance to the default sub in the constructor (reported with + failing tests by rjbs) 0.12 Thu Dec 4 19:23:10 2008 * Provide Test::Exception function unless it's version 0.27 - RT #41254 diff --git a/lib/Mouse/Object.pm b/lib/Mouse/Object.pm index 8c36df3..9921711 100644 --- a/lib/Mouse/Object.pm +++ b/lib/Mouse/Object.pm @@ -39,7 +39,7 @@ sub new { my $value = $attribute->has_builder ? $instance->$builder : ref($default) eq 'CODE' - ? $default->() + ? $default->($instance) : $default; $attribute->verify_type_constraint($value)