Incorporate the throw_error bits from Moose turnk
Dave Rolsky [Thu, 18 Sep 2008 15:11:20 +0000 (15:11 +0000)]
lib/MooseX/Singleton/Meta/Method/Constructor.pm

index 520483a..6e83444 100644 (file)
@@ -64,7 +64,10 @@ 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;
 }