![]() |
![]()
| ![]() |
![]()
NAMEType::Tiny::Signatures - Type::Tiny Method/Function Signatures VERSIONversion 0.08 SYNOPSISuse Type::Tiny; use Type::Tiny::Signatures; method hello (Str $greeting, Str $fullname) { print "$greeting, $fullname\n"; } DESCRIPTIONThis module uses Function::Parameters to extend Perl with keywords that let you define methods and functions with parameter lists which can be validated using Type::Tiny type constraints. The type constraints can be provided by the Type::Tiny standard library, Types::Standard, or any supported user-defined type library which can be a Moose, MooseX::Type, MouseX::Type, or Type::Library library. use Type::Tiny; use Type::Tiny::Signatures 'MyApp::Types'; method identify (Str $name, SSN $number) { print "identifying $name using SSN $number\n"; } The method and function signatures can be configured to validate user-defined type constraints by passing the user-defined type library package name as an argument to the Type::Tiny::Signatures usage declaration. The default behavior configures the Function::Parameters pragma using options that mimick the previously default lax-mode, i.e. strict-mode disabled. AUTHORAl Newkirk <al@iamalnewkirk.com> COPYRIGHT AND LICENSEThis software is copyright (c) 2018 by Al Newkirk. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
|