When inlining with Moose 2.0+, close over hash of allowed attrs rather than regenerat...
[gitmo/MooseX-StrictConstructor.git] / lib / MooseX / StrictConstructor / Trait / Class.pm
index 707c75f..b96e5fd 100644 (file)
@@ -47,8 +47,7 @@ around '_inline_BUILDALL' => sub {
 
     return (
         @source,
-        'my %attrs = (' . ( join ' ', @attrs ) . ');',
-        'my @bad = sort grep { !$attrs{$_} } keys %{ $params };',
+        'my @bad = sort grep { !$allowed_attrs{$_} } keys %{ $params };',
         'if (@bad) {',
             'Moose->throw_error("Found unknown attribute(s) passed to the constructor: @bad");',
         '}',