- SEE ALSO
- COPYRIGHT AND LICENCE
- DISCLAIMER OF WARRANTIES
Kavorka::Signature - a function signature
Kavorka::Signature is a class where each instance represents a function signature. This class is used to parse the function signature, and also to inject Perl code into the final function.
Instances of this class are also returned by Kavorka's function introspection API.
A signature instance has the following methods. Each method which returns parameters, returns an instance of Kavorka::Parameter.
Returns the package name the parameter was declared in.
Returns an arrayref of parameters.
Returns an arrayref of declared return types.
Returns a boolean/list of invocant parameters.
Returns a list of positional parameters.
Returns a boolean/list of named parameters.
Returns a boolean indicating whether there is a slurpy parameter in this signature / returns the slurpy parameter.
Indicates whether the yadayada operator was encountered in the signature.
The numeric index of the last positional parameter.
The minimum/maximum number of arguments expected by the function. Invocants are not counted. If there are any named or slurpy arguments, of the yada yada operator was used in the signature, then
args_maxwill be undef.
@args(which should include any invocants) would satisfy the signature.
Returns a coderef which acts like
Returns a string of Perl code that acts like an inline check, given the name of an array variable, such as
An internal method used to parse a signature. Only makes sense to use within a Parse::Keyword parser.
A class to use for parameters when parsing the signature.
A class to use for return types when parsing the signature.
The string of Perl code to inject for this signature.
Tests that the signature is sane. (For example it would not be sane to have a slurpy parameter prior to a positional one.)
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Kavorka.
Toby Inkster <email@example.com>.
This software is copyright (c) 2013-2014, 2017 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.