my %metaroles = (
+ base_class_roles => [ 'MooseX::UndefTolerant::Object' ],
class_metaroles => {
attribute => [ 'MooseX::UndefTolerant::Attribute' ],
}
Loading this module in your L<Moose> class makes initialization of your
attributes tolerant of undef. If you specify the value of undef to any of
the attributes they will not be initialized, effectively behaving as if you
-had not provided a value at all.
+had not provided a value at all. Such values are also cleaned from BUILDARGS.
You can also apply the 'UndefTolerant' trait to individual attributes. See
L<MooseX::UndefTolerant::Attribute> for details.
=head1 CAVEATS
This extension does not currently work in immutable classes when applying the
-trait to some (but not all) attributes in the class. This is because the
-inlined constructor initialization code currently lives in
+trait to a specific attributes in the class, as opposed to the class itself.
+This is because the inlined constructor initialization code currently lives in
L<Moose::Meta::Class>, not L<Moose::Meta::Attribute>. The good news is that
this is expected to be changing shortly.
+Also, BUILDARGS cannot be cleaned up if the entire class is not made undef
+tolerant, as attribute traits cannot modify class constructor behaviour.
+
=head1 ACKNOWLEDGEMENTS
Many thanks to the crew in #moose who talked me through this module: