When a type coercion is attempted, this type constraint metaclass tries to autoload a specific module which is supposed to contain the actual coercion code.
This allows you to declare types that can be replaced (through coercion) at the end user's discretion.
When a type coercion is attempted, this type constraint metaclass tries to autoload a specific module which is supposed to contain the actual coercion code.
This allows you to declare types that can be replaced (through coercion) at the end user's discretion.
-It works with both L<Moose> and L<Mouse> by using L<Any::Moose>.
+It only supports L<Mouse> currently.
-Note that you will need L<Moose::Util::TypeConstraints/register_type_constraint> or L<Mouse::Util::TypeConstraints/register_type_constraint> to install this type constraint, and that the latter is only available starting L<Mouse> C<0.63>.
+Note that you will need L<Mouse::Util::TypeConstraints/register_type_constraint> to install this type constraint, which is only available starting L<Mouse> C<0.63>.
This must be the target of both the classes that want to use the autocoercion feature and the user defined coercions in the autoloaded classes.
The name of the type constraint.
This must be the target of both the classes that want to use the autocoercion feature and the user defined coercions in the autoloaded classes.
-This attribute is inherited from the L<Moose> or L<Mouse> type constraint metaclass.
+This attribute is inherited from the L<Mouse> type constraint metaclass.
=head2 C<mapper>
=head2 C<mapper>
@@ -135,7+133,7 @@ If it is given as a plain string, then a type constraint with the same name is s
has 'target' => (
is => 'ro',
has 'target' => (
is => 'ro',
- isa => any_moose('Meta::TypeConstraint'),
+ isa => 'Mouse::Meta::TypeConstraint',
required => 1,
);
required => 1,
);
@@ -144,7+142,13 @@ my $target_tc = __PACKAGE__->meta->find_attribute_by_name('target')
=head1 METHODS
=head1 METHODS
-=head2 C<< new name => $name, mapper => $mapper, target => $target >>
+=head2 C<new>
+
+ my $tc = LaTeX::TikZ::Meta::TypeConstraint::Autocoerce->new(
+ name => $name,
+ mapper => $mapper,
+ target => $target,
+ );
Constructs a type constraint object that will attempt to autocoerce objects that are not valid according to C<$target> by loading the class returned by C<$mapper>.
Constructs a type constraint object that will attempt to autocoerce objects that are not valid according to C<$target> by loading the class returned by C<$mapper>.