X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FStrictConstructor.pm;h=f14e4c452bfdff08877bf08356094874472f67cf;hb=HEAD;hp=2f2367aac21a6cca1e41ab5e01a06c2ff80e5c40;hpb=01265e2a46aee790b0616f8ba64df57817daafd6;p=gitmo%2FMooseX-StrictConstructor.git diff --git a/lib/MooseX/StrictConstructor.pm b/lib/MooseX/StrictConstructor.pm index 2f2367a..f14e4c4 100644 --- a/lib/MooseX/StrictConstructor.pm +++ b/lib/MooseX/StrictConstructor.pm @@ -6,17 +6,20 @@ use warnings; use Moose 0.94 (); use Moose::Exporter; use Moose::Util::MetaRole; -use MooseX::StrictConstructor::Role::Object; -use MooseX::StrictConstructor::Role::Meta::Class; - -Moose::Exporter->setup_import_methods( - class_metaroles => { - class => - ['MooseX::StrictConstructor::Role::Meta::Class'] - }, - base_class_roles => ['MooseX::StrictConstructor::Role::Object'], + +use MooseX::StrictConstructor::Trait::Class; +use MooseX::StrictConstructor::Trait::Method::Constructor;; + +my %metaroles = ( + class => ['MooseX::StrictConstructor::Trait::Class'], ); +$metaroles{constructor} + = ['MooseX::StrictConstructor::Trait::Method::Constructor'] + if $Moose::VERSION <= 1.9900; + +Moose::Exporter->setup_import_methods( class_metaroles => \%metaroles ); + 1; # ABSTRACT: Make your object constructors blow up on unknown attributes @@ -42,9 +45,9 @@ __END__ =head1 DESCRIPTION Simply loading this module makes your constructors "strict". If your -constructor is called with an attribute init argument that your class -does not declare, then it calls "Carp::confess()". This is a great way -to catch small typos. +constructor is called with an attribute init argument that your class does not +declare, then it calls C<< Moose->throw_error() >>. This is a great way to +catch small typos. =head2 Subverting Strictness