Type::API::Constraint::Inlinable - allows a string of code to be generated to check a given variable
Implementations of Type::API::Constraint::Inlinable MUST also implement Type::API::Constraint.
Implementations MUST provide the following methods:
Returns a boolean indicating whether inlining support is available for this type constraint.
$variable_namewill be a string such as
'$_'. Should return a string of code that may be evaluated to determine the pass/failure of the value in the given variable. The string MUST NOT include
gotoor other flow control keywords that would make it unsuitable for inlining into a larger function.
There is not currently any mechanism to request that the string of code in a particular programming language, nor a mechanism for the implementation to indicate what language it has generated. However, the implementations that have been investigated have returned Perl 5 code. Nevertheless, this is an area for further investigation.
MAY advertise that they support this interface by returning true for
The following CPAN classes are known to implement Type::API::Constraint::Inlinable:
Specio::Constraint::Simple (and several other classes in the Specio distribution)
Type::Tiny (and its subclasses)
The following CPAN classes implement this interface with a minor difference; the
inline_check method is called
_inline_check instead. Tools wishing to make use of this interface should consider supporting this variation.
Toby Inkster <firstname.lastname@example.org>.
This software is copyright (c) 2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.