MooseX::AlwaysCoerce - Automatically enable coercions for Moose attributes
package MyClass; use Moose; use MooseX::AlwaysCoerce; use MyTypeLib 'SomeType'; has foo => (is => 'rw', isa => SomeType); # coerce => 1 automatically added # same, MooseX::ClassAttribute is automatically applied class_has bar => (is => 'rw', isa => SomeType);
Have you ever spent an hour or more trying to figure out "Hey, why did my coercion not run?" only to find out that you forgot
coerce => 1 ?
Just load this module in your Moose class and
coerce => 1 will be enabled for every attribute and class attribute automatically.
coerce => 0 to disable a coercion explicitly.
Please report any bugs or feature requests to
bug-moosex-alwayscoerce at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-AlwaysCoerce. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find more information at:
My own stupidity, for inspiring me to write this module.
Dave Rolsky, for telling me how to do it the Moose way.
Rafael Kitover <email@example.com>
This software is copyright (c) 2009 by Rafael Kitover <firstname.lastname@example.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.