1 package MooseX::StrictConstructor::Role::Meta::Method::Constructor;
10 around '_generate_BUILDALL' => sub
15 my $source = $self->$orig();
16 $source .= ";\n" if $source;
21 map { $_->init_arg() }
22 @{ $self->_attributes() }
26 my \%attrs = (@attrs);
28 my \@bad = sort grep { ! \$attrs{\$_} } keys \%{ \$params };
31 Carp::confess "Found unknown attribute(s) passed to the constructor: \@bad";
48 MooseX::StrictConstructor::Role::Meta::Method::Constructor - A role to make immutable constructors strict
52 Moose::Util::MetaRole::apply_metaclass_roles
53 ( for_class => $caller,
54 constructor_class_roles =>
55 ['MooseX::StrictConstructor::Role::Meta::Method::Constructor'],
60 This role simply wraps C<_generate_BUILDALL()> (from
61 C<Moose::Meta::Method::Constructor>) so that immutable classes have a
66 Dave Rolsky, C<< <autarch@urth.org> >>
68 =head1 COPYRIGHT & LICENSE
70 Copyright 2007-2008 Dave Rolsky, All Rights Reserved.
72 This program is free software; you can redistribute it and/or modify
73 it under the same terms as Perl itself.