在 Manus 中运行任何 Skill
一键导入
一键导入
一键在 Manus 中运行任何 Skill
开始使用kura-perl
Store and export type constraints for Type::Tiny, Moose, Data::Checks, and more
星标0
分支0
更新时间2025年11月14日 07:35
SKILL.md
readonly菜单
Store and export type constraints for Type::Tiny, Moose, Data::Checks, and more
| name | kura-perl |
| description | Store and export type constraints for Type::Tiny, Moose, Data::Checks, and more |
| version | 1.0.0 |
| author | kfly8 |
| tags | ["perl","cpan","type-constraints","validation"] |
kura provides a simple way to store and export type constraints from multiple libraries.
use Exporter 'import';
use Types::Common -types;
use kura Name => StrLength[1, 255];
use kura Age => Int & sub { $_ >= 0 };
use kura Email => sub { /@/ }; # Code ref auto-converted
Syntax: use kura NAME => CONSTRAINT;
constraint and messagepackage MyTypes {
use parent 'Exporter::Tiny';
use Types::Common -types;
use kura Name => StrLength[1, 255];
use kura Email => Str & sub { /@/ };
}
use MyTypes qw(Name Email);
Name->check('John'); # true
class User {
use Types::Common -types;
use kura Name => StrLength[1, 255];
field $name :param :reader;
ADJUST {
Name->assert_valid($name);
}
}
my $user = User->new(name => ''); # Dies: validation error
use Exporter 'import';use kura Child => Str;
use kura Parent => Dict[ name => Child ]; # Correct order
_ to prevent export
use kura _Private => Str; # Not exported
@EXPORT_OK and @KURA are auto-populated