some changes to work the next Moose, making constructor inlining work
[gitmo/MooseX-Singleton.git] / lib / MooseX / Singleton / Meta / Method / Constructor.pm
index c27085f..e95e318 100644 (file)
@@ -39,6 +39,8 @@ sub initialize_body {
 
     my $code;
     {
+        my $meta = $self;
+
         # NOTE:
         # create the nessecary lexicals
         # to be picked up in the eval
@@ -62,9 +64,16 @@ sub initialize_body {
         } @type_constraints;
 
         $code = eval $source;
-        confess "Could not eval the constructor :\n\n$source\n\nbecause :\n\n$@" if $@;
+        $self->throw_error(
+            "Could not eval the constructor :\n\n$source\n\nbecause :\n\n$@",
+            error => $@, data => $source )
+            if $@;
     }
-    $self->{'&!body'} = $code;
+    $self->{'body'} = $code;
+}
+
+sub _expected_constructor_class {
+    return 'MooseX::Singleton::Object';
 }
 
 no Moose;