NAME
Kavorka::Signature - a function signature
DESCRIPTION
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.
Introspection API
A signature instance has the following methods. Each method which returns parameters, returns an instance of Kavorka::Signature::Parameter.
package
-
Returns the package name the parameter was declared in.
params
-
Returns an arrayref of parameters.
has_invocants
,invocants
-
Returns a boolean/list of invocant parameters.
positional_params
-
Returns a list of positional parameters.
has_named
,named_params
-
Returns a boolean/list of named parameters.
has_slurpy
,slurpy
-
Returns a boolean indicating whether there is a slurpy parameter in this signature / returns the slurpy parameter.
yadayada
-
Indicates whether the yadayada operator was encountered in the signature.
last_position
-
The numeric index of the last positional parameter.
Other Methods
parse
-
An internal method used to parse a signature. Only makes sense to use within a Parse::Keyword parser.
parameter_class
-
A class to use for parameters when parsing the signature.
injection
-
The string of Perl code to inject for this signature.
sanity_check
-
Tests that the signature is sane. (For example it would not be sane to have a slurpy parameter prior to a positional one.)
BUGS
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Kavorka.
SEE ALSO
http://perlcabal.org/syn/S06.html, Kavorka, Kavorka::Signature::Parameter.
AUTHOR
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT AND LICENCE
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.
DISCLAIMER OF WARRANTIES
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.