- or download this
use Type::Standard -moose, qw(Int);
use Type::Standard -mouse, qw(Int);
use Type::Standard -moo, qw(Int);
- or download this
use v5.16;
use Benchmark qw(cmpthese);
...
Rate native tt
native 2511/s -- -45%
tt 4525/s 80% --
- or download this
use Moose::Util::TypeConstraints;
coerce 'Str',
from 'ArrayRef', via { join "\n", @$_ };
- or download this
package MyClass {
use Moose;
use Types::Standard qw(ArrayRef Str);
...
isa => Str->plus_coercions(ArrayRef, sub { join "\n", @$_
+}),
);
}
- or download this
package MyClass {
use Moose;
use Types::Standard qw(Int);
...
isa => Int->where(sub { $_ % 2 == 0 }),
);
}
- or download this
package MyClass {
use Moose;
use Types::Standard qw(ArrayRef);
...
isa => ArrayRef[Int],
);
}
- or download this
use v5.16;
package MyClass {
...
return $self;
}
}