With Moose, it is no longer possible to have a coercing attribute in an
immutable class be updated with coercions loaded "late". These
semantics are actually quite understandable, but on the other hand there's
no easy way to recover which attributes coerce to a given type coercion,
which would allow us to manually force the recompilation of the coercing
code for the attributes. Thus we have to make the classes that contain
such an attribute mutable when Moose is in use.
},
);
-__PACKAGE__->meta->make_immutable;
+__PACKAGE__->meta->make_immutable if any_moose() ne 'Moose';
=head1 SEE ALSO
coerce => 1,
handles => [ 'id' ],
);
- __PACKAGE__->meta->make_immutable;
+ # This class shouldn't be immutable when using Moose, or the
+ # coercing attributes will not be updated with the future coercions.
+ __PACKAGE__->meta->make_immutable if any_moose() ne 'Moose';
}
# Another class the user wants to use instead of X (cannot be changed)
}
);
-__PACKAGE__->meta->make_immutable;
+__PACKAGE__->meta->make_immutable if any_moose() ne 'Moose';
=head1 SEE ALSO
coerce => 1,
);
- __PACKAGE__->meta->make_immutable;
+ __PACKAGE__->meta->make_immutable if any_moose() ne 'Moose';
sub main::Z () { __PACKAGE__ }
}