Type::API::Constraint::Coercible

Interface

Implementations of Type::API::Constraint::Coercible MUST also implement Type::API::Constraint .

Implementations MUST provide the following methods:

$constraint->has_coercion

Returns a boolean indicating whether a coercion is available for this type constraint.

$constraint->coerce($value)

Attempts to coerce the value into a value that would pass the type constraint; this method returns the new value. This method offers no guarantee that the returned value passes the constraint; that must be checked with check .

Implementations MAY advertise that they support this interface by returning true for $constraint->DOES("Type::API::Constraint::Coercible") .

See Also

Implementations

The following CPAN classes are known to implement Type::API::Constraint::Coercible:

Consumers

Some tools can make use of objects implementing Type::API::Constraint::Coercible:

Others, such as Moose and Mouse require type constraints that implement a superset of this functionality.