X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FUndefTolerant.pm;h=0f3bec64fb276cdf71d39dc7795c0e48940bf558;hb=7eb7874553db0f791c7b585d17f4c252d6a1ff88;hp=92bd4925ec5c8074e41629e2cae92c585b86a666;hpb=d0abfb45e6748fe6594c2502206b30d2940a36aa;p=gitmo%2FMooseX-UndefTolerant.git diff --git a/lib/MooseX/UndefTolerant.pm b/lib/MooseX/UndefTolerant.pm index 92bd492..0f3bec6 100644 --- a/lib/MooseX/UndefTolerant.pm +++ b/lib/MooseX/UndefTolerant.pm @@ -6,7 +6,7 @@ use Moose::Exporter; use MooseX::UndefTolerant::Attribute; use MooseX::UndefTolerant::Constructor; -our $VERSION = '0.04'; +our $VERSION = '0.07'; Moose::Exporter->setup_import_methods( class_metaroles => { @@ -86,31 +86,19 @@ Maybe[Str] and I still want my predicate (C) to work. The only real solution was: if(defined($foo)) { - $class = My:CLass->new(foo => $foo, bar => 123); + $class = My:Class->new(foo => $foo, bar => 123); } else { - $class = My:CLass->new(bar => 123); + $class = My:Class->new(bar => 123); } Or some type of codemulch using ternarys. This module allows you to make your attributes more tolerant of undef so that you can keep the first example: have your cake and eat it too! -=head1 USE IN YOUR MOOSE EXPORTER - -If you already have a custom Moose exporter class and you want this -behaviour everywhere, you can add these roles there with this call, in -your C routine: - - Moose::Util::MetaRole::apply_metaroles( - class_metaroles => { - attribute => [ 'MooseX::UndefTolerant::Attribute' ], - constructor => [ 'MooseX::UndefTolerant::Constructor' ], - }, - for => $args{for_class}, - ); - =head1 PER ATTRIBUTE +See L. + =head1 AUTHOR Cory G Watson, C<< >>