Moove - functions and methods with parameter lists and type constraints
version 0.006
use Moove; func foo (Int $number, Str $text) { ... } use Moove classes => [qw[ Some::Class ]]; method bar (Some::Class $obj) { ... } use Moove -trycatch; func foobar () { try { die "meh"; } catch { return "caught meh."; } } use Moove -autoclass; method bar (Some::Class $obj) { ... }
This module inherits Function::Parameters with some defaults and type constraints with Type::Tiny.
Some reasons to use Moove:
No Moose dependency
No Devel::Declare dependency
A nearly replacement for Method::Signatures
But with some differences...
This is also a very early release.
The import method supports these keywords:
types
As an ArrayRef, calls Types::Registry->for_class($caller)->add_types(@$types).
Types::Registry->for_class($caller)->add_types(@$types)
As a ScalarRef, calls Types::Registry->for_class($caller)->add_types($$types).
Types::Registry->for_class($caller)->add_types($$types)
classes
For each class in this ArrayRef, calls Types::Registry->for_class($caller)->add_types(Type::Utils::class_type($class)).
Types::Registry->for_class($caller)->add_types(Type::Utils::class_type($class))
-nostdtypes
Do not import Types::Standard.
-trycatch
Import Syntax::Feature::Try with type constraints.
-autoclass
Enable auto-generation of class contraints (Type::Tiny::Class) if the constraint looks like a package name (/^\w+(::\w+)+$/). This always takes precedence over the general type registry.
/^\w+(::\w+)+$/
This also works with -trycatch.
Please report any bugs or feature requests on the bugtracker website https://github.com/zurborg/libmoove-perl/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
David Zurborg <zurborg@cpan.org>
This software is Copyright (c) 2016 by David Zurborg.
This is free software, licensed under:
The ISC License
To install Moove, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Moove
CPAN shell
perl -MCPAN -e shell install Moove
For more information on module installation, please visit the detailed CPAN module installation guide.