X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FStrictConstructor.pm;h=030230ff97dd0b56f23d7a3061fd45ee03f92b57;hb=2c89d023a1ddcafb64035d89061e12e791ec1938;hp=28c71e7f4502a520e6962640d24d89e1424c4725;hpb=5b66b6d4b70a18c011287412c56f34a321d79d87;p=gitmo%2FMooseX-StrictConstructor.git diff --git a/lib/MooseX/StrictConstructor.pm b/lib/MooseX/StrictConstructor.pm index 28c71e7..030230f 100644 --- a/lib/MooseX/StrictConstructor.pm +++ b/lib/MooseX/StrictConstructor.pm @@ -6,16 +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::Method::Constructor; -Moose::Exporter->setup_import_methods( - class_metaroles => { - constructor => - ['MooseX::StrictConstructor::Role::Meta::Method::Constructor'] - }, - base_class_roles => ['MooseX::StrictConstructor::Role::Object'], -); +{ + my %class_meta = ( class => ['MooseX::StrictConstructor::Trait::Class'] ); + + if ( $Moose::VERSION < 1.9900 ) { + require MooseX::StrictConstructor::Trait::Method::Constructor; + $class_meta{constructor} + = ['MooseX::StrictConstructor::Trait::Method::Constructor']; + } + + Moose::Exporter->setup_import_methods( + class_metaroles => \%class_meta, + ); +} 1; @@ -43,7 +47,7 @@ __END__ 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 +does not declare, then it calls Cthrow_error()>. This is a great way to catch small typos. =head2 Subverting Strictness