NAME
Parse::Method::Signatures - Perl6 like method signature parser
DESCRIPTION
Inspired by Perl6::Signature but streamlined to just support the subset deemed useful for TryCatch and MooseX::Method::Signatures.
TODO
Document the parameter return types.
Probably lots of other things
METHODS
There are only two public methods to this module, both of which should be called as class methods.
signature
my $sig = Parse::Method::Signatures->signature( '(Str $foo)' )
Attempts to parse the (bracketed) method signature. Returns a value or croaks on error.
param
my $param = Parse::Method::Signatures->param( 'Str $foo where { length($_) < 10 }')
Attempts to parse the specification for a single parameter. Returns value or croaks on error.
CAVEATS
Like Perl6::Signature, the parsing of certain constructs is currently only a 'best effort' - specifically default values and where code blocks might not successfully for certain complex cases. Patches/Failing tests welcome.
Additionally, default value specifications are not evaluated which means that no such lexical or similar errors will not be produced by this module. Constant folding will also not be performed.
AUTHOR
Ash Berlin <ash@cpan.org>.
Thanks to Florian Ragwitz <rafl@debian.org>.
SEE ALSO
Devel::Declare which is used by most modules that use this (currently by all modules known to the author.)
http://github.com/ashb/trycatch/tree.
MooseX::Method::Signatures and MooseX::Declare which are due to be ported to use this module.
LICENSE
Licensed under the same terms as Perl itself.