MooseX::AlwaysCoerce - Automatically enable coercions for Moose attributes
version 0.23
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 ?
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
My own stupidity, for inspiring me to write this module.
Dave Rolsky, for telling me how to do it the Moose way.
Bugs may be submitted through the RT bug tracker (or bug-MooseX-AlwaysCoerce@rt.cpan.org).
There is also a mailing list available for users of this distribution, at http://lists.perl.org/list/moose.html.
There is also an irc channel available for users of this distribution, at #moose on irc.perl.org.
#moose
irc.perl.org
Rafael Kitover <rkitover@cpan.org>
Karen Etheridge <ether@cpan.org>
Jesse Luehrs <doy@tozt.net>
Michael G. Schwern <schwern@pobox.com>
This software is copyright (c) 2009 by Rafael Kitover <rkitover@cpan.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.
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.