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=f14e4c452bfdff08877bf08356094874472f67cf;hp=40fa4bb21de897603cd3c2c8ea12845b5100c418;hb=1a9d90ea66c704b902eda8d4c26d1262cc716abd;hpb=b98b8f867754f1c69f1cae8ac1b6fc0bb2544e3a diff --git a/lib/MooseX/StrictConstructor.pm b/lib/MooseX/StrictConstructor.pm index 40fa4bb..f14e4c4 100644 --- a/lib/MooseX/StrictConstructor.pm +++ b/lib/MooseX/StrictConstructor.pm @@ -7,20 +7,18 @@ use Moose 0.94 (); use Moose::Exporter; use Moose::Util::MetaRole; -{ - 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, - ); -} +Moose::Exporter->setup_import_methods( class_metaroles => \%metaroles ); 1; @@ -47,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