use Moose->throw_error rather than confess
[gitmo/MooseX-StrictConstructor.git] / lib / MooseX / StrictConstructor / Trait / Class.pm
index f3d2850..0c73318 100644 (file)
@@ -1,12 +1,10 @@
 package MooseX::StrictConstructor::Trait::Class;
 
-use strict;
-use warnings;
+use Moose::Role;
 
-use B ();
-use Carp ();
+use namespace::autoclean;
 
-use Moose::Role;
+use B ();
 
 around '_inline_BUILDALL' => sub {
     my $orig = shift;
@@ -26,13 +24,11 @@ around '_inline_BUILDALL' => sub {
         'my %attrs = (' . ( join ' ', @attrs ) . ');',
         'my @bad = sort grep { !$attrs{$_} } keys %{ $params };',
         'if (@bad) {',
-            'Carp::confess "Found unknown attribute(s) passed to the constructor: @bad";',
+            'Moose->throw_error("Found unknown attribute(s) passed to the constructor: @bad");',
         '}',
     );
 };
 
-no Moose::Role;
-
 1;
 
 # ABSTRACT: A role to make immutable constructors strict