MooseX::AlwaysCoerce - Automatically enable coercions for Moose attributes
Version 0.07
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 "WTF, why did my coercion not run?" only to find out that you forgot coerce => 1 ?
coerce => 1
Just load this module in your Moose class and coerce => 1 will be enabled for every attribute and class attribute automatically.
Use coerce => 0 to disable a coercion explicitly.
coerce => 0
Rafael Kitover, <rkitover at cpan.org>
<rkitover at cpan.org>
Schwern: Michael G. Schwern <mschwern@cpan.org> Ether: Karen Etheridge <ether@cpan.org>
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.
bug-moosex-alwayscoerce at rt.cpan.org
You can find more information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooseX-AlwaysCoerce
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/MooseX-AlwaysCoerce
CPAN Ratings
http://cpanratings.perl.org/d/MooseX-AlwaysCoerce
Search CPAN
http://search.cpan.org/dist/MooseX-AlwaysCoerce/
My own stupidity, for inspiring me to write this module.
Dave Rolsky, for telling me how to do it the Moose way.
Copyright (c) 2009-2010 Rafael Kitover
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install MooseX::AlwaysCoerce, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::AlwaysCoerce
CPAN shell
perl -MCPAN -e shell install MooseX::AlwaysCoerce
For more information on module installation, please visit the detailed CPAN module installation guide.