25 Sep 2020 00:31:59 UTC
- Distribution: Type-Tiny-XS
- Module version: 0.022
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (0)
- Testers (4594 / 0 / 0)
- KwaliteeBus factor: 2
- 48.51% Coverage
- License: perl_5
- Perl: v5.10.1
- Activity24 month
- Download (79.1KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:8 non-PAUSE usersTOBYINK Toby Inkster
Type::Tiny::XS - provides an XS boost for some of Type::Tiny's built-in type constraints
use Types::Standard qw(Int);
This module is optionally used by Type::Tiny 0.045_03 and above to provide faster, C-based implementations of some type constraints. (This package has only core dependencies, and does not depend on Type::Tiny, so other data validation frameworks might also consider using it!)
Only the following three functions should be considered part of the supported API:
Given a supported type constraint name, such as
"Int", returns a coderef that can be used to validate a parameter against this constraint.
Returns undef if this module cannot provide a suitable coderef.
get_coderef_forbut returns the name of such a sub as a string.
Returns undef if this module cannot provide a suitable sub name.
Returns true if the coderef was provided by Type::Tiny::XS.
In addition to the above functions, the subs returned by
get_subname_forare considered part of the "supported API", but only for the lifetime of the Perl process that returned them.
To clarify, if you call
get_subname_for("ArrayRef[Int]")in a script, this will return the name of a sub. That sub (which can be used to validate arrayrefs of integers) is now considered part of the supported API of Type::Tiny::XS until the script finishes running. Next time the script runs, there is no guarantee that the sub will continue to exist, or continue to do the same thing.
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Type-Tiny-XS.
Toby Inkster <firstname.lastname@example.org> forked all this from Mouse::Util::TypeConstraints.
ArrayLike, HashLike, CodeLike, and StringLike constraints based on code by ikegami on StackOverflow.
This software is copyright (c) 2014, 2018-2020 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.
Module Install Instructions
To install Type::Tiny::XS, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Type::Tiny::XS
For more information on module installation, please visit the detailed CPAN module installation guide.