Boxer
view release on metacpan or search on metacpan
lib/Boxer/Types.pm view on Meta::CPAN
package Boxer::Types;
=encoding UTF-8
=cut
use v5.14;
use utf8;
use Role::Commons -all;
use namespace::autoclean;
use Path::Tiny;
use Type::Library -base, -declare => qw(
WorldName DataDir ClassDir NodeDir SkelDir Basename Suite SerializationList );
use Type::Utils;
use Types::Standard qw( ArrayRef Split Str Tuple StrMatch slurpy );
use Types::Common::String qw( NonEmptySimpleStr LowerCaseSimpleStr );
use Types::Path::Tiny qw(Dir);
use strictures 2;
no warnings "experimental::signatures";
=head1 VERSION
Version v1.4.3
=cut
our $VERSION = "v1.4.3";
declare WorldName, as LowerCaseSimpleStr,
coercion => 1,
message {'Must be a single lowercase word'};
declare DataDir, as Dir, coercion => 1, message {
'Must be an existing directory containing directories for boxer classes and/or boxer nodes';
};
declare ClassDir, as Dir,
coercion => 1,
message {'Must be an existing directory containing boxer classes'};
declare NodeDir, as Dir,
coercion => 1,
message {'Must be an existing directory containing boxer nodes'};
declare SkelDir, as Dir,
coercion => 1,
message {'Must be an existing directory containing boxer skeleton files'};
declare Basename, as NonEmptySimpleStr,
where { $_ eq path($_)->basename },
message {'Must be a bare filename with no directory parts'};
declare Suite, as LowerCaseSimpleStr,
coercion => 1,
message {'Must be a single lowercase word'};
my $SerializationList = "Type::Tiny"->new(
name => 'SerializationList',
parent =>
Tuple [ slurpy ArrayRef [ StrMatch [qr{^(?:preseed|script)$}] ] ],
);
declare SerializationList,
as $SerializationList->plus_coercions( Split [qr/[^a-z]+/] ),
coercion => 1,
message {'Must be one or more of these words: preseed script'};
=head1 AUTHOR
( run in 0.593 second using v1.01-cache-2.11-cpan-39bf76dae61 )