Fix for default in a constructor reported and tested by rjbs :)
Shawn M Moore [Fri, 5 Dec 2008 01:25:33 +0000 (01:25 +0000)]
Changes
lib/Mouse/Object.pm

diff --git a/Changes b/Changes
index d167e55..961cad7 100644 (file)
--- 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
index 8c36df3..9921711 100644 (file)
@@ -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)