X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-StrictConstructor.git;a=blobdiff_plain;f=lib%2FMooseX%2FStrictConstructor.pm;h=926e780ac58950b4b5ed42fe191c38db7f5dc66e;hp=c68d27931d6a38d75e3633b89c53d1d1366d91cb;hb=b40503314ef6f2cf6f88378e9f35d7a91866b277;hpb=0dc0aea2e2ce6e27b488b6e6d304c5ab19649745 diff --git a/lib/MooseX/StrictConstructor.pm b/lib/MooseX/StrictConstructor.pm index c68d279..926e780 100644 --- a/lib/MooseX/StrictConstructor.pm +++ b/lib/MooseX/StrictConstructor.pm @@ -6,23 +6,19 @@ use warnings; use Moose 0.94 (); use Moose::Exporter; use Moose::Util::MetaRole; -use MooseX::StrictConstructor::Role::Object; -{ - my %class_meta = ( class => ['MooseX::StrictConstructor::Trait::Class'] ); +use MooseX::StrictConstructor::Trait::Class; +use MooseX::StrictConstructor::Trait::Method::Constructor;; +my %metaroles = ( + class => ['MooseX::StrictConstructor::Trait::Class'], +); - if ( $Moose::VERSION < 1.9900 ) { - require MooseX::StrictConstructor::Trait::Method::Constructor; - $class_meta{constructor} - = ['MooseX::StrictConstructor::Trait::Method::Constructor']; - } +$metaroles{constructor} + = ['MooseX::StrictConstructor::Trait::Method::Constructor'] + if $Moose::VERSION >= 1.9900; - Moose::Exporter->setup_import_methods( - class_metaroles => \%class_meta, - base_class_roles => ['MooseX::StrictConstructor::Role::Object'], - ); -} +Moose::Exporter->setup_import_methods( class_metaroles => \%metaroles ); 1; @@ -49,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 Cthrow_error()>. 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