package MooseX::StrictConstructor::Trait::Class;
-use strict;
-use warnings;
+use Moose::Role;
+
+use namespace::autoclean;
use B ();
use Carp ();
-use Moose::Role;
-
around '_inline_BUILDALL' => sub {
my $orig = shift;
my $self = shift;
return (
@source,
- 'my %attrs = (' . join(' ', @attrs) . ');',
+ 'my %attrs = (' . ( join ' ', @attrs ) . ');',
'my @bad = sort grep { !$attrs{$_} } keys %{ $params };',
'if (@bad) {',
'Carp::confess "Found unknown attribute(s) passed to the constructor: @bad";',
);
};
-no Moose::Role;
-
1;
# ABSTRACT: A role to make immutable constructors strict
=pod
-=head1 SYNOPSIS
-
- Moose::Util::MetaRole::apply_metaroles(
- for_class => $caller,
- class => {
- constructor =>
- ['MooseX::StrictConstructor::Trait::Method::Constructor'],
- },
- );
-
=head1 DESCRIPTION
This role simply wraps C<_inline_BUILDALL()> (from