File Coverage

blib/lib/Boxer/Types.pm
Criterion Covered Total %
statement 35 35 100.0
branch n/a
condition n/a
subroutine 12 12 100.0
pod n/a
total 47 47 100.0


line stmt bran cond sub pod time code
1             package Boxer::Types;
2              
3             =encoding UTF-8
4              
5             =cut
6              
7 6     6   68 use v5.14;
  6         35  
8 6     6   29 use utf8;
  6         10  
  6         33  
9 6     6   166 use Role::Commons -all;
  6         12  
  6         35  
10 6     6   8956 use namespace::autoclean;
  6         20  
  6         39  
11              
12 6     6   1052 use Path::Tiny;
  6         9707  
  6         375  
13              
14 6         40 use Type::Library -base, -declare => qw(
15 6     6   34 WorldName DataDir ClassDir NodeDir SkelDir Basename Suite SerializationList );
  6         8  
16 6     6   8485 use Type::Utils;
  6         24717  
  6         46  
17 6     6   7525 use Types::Standard qw( ArrayRef Split Str Tuple StrMatch slurpy );
  6         11  
  6         21  
18 6     6   8583 use Types::Common::String qw( NonEmptySimpleStr LowerCaseSimpleStr );
  6         211465  
  6         66  
19 6     6   5609 use Types::Path::Tiny qw(Dir);
  6         85664  
  6         37  
20              
21 6     6   1901 use strictures 2;
  6         47  
  6         213  
22 6     6   1116 no warnings "experimental::signatures";
  6         10  
  6         2442  
23              
24             =head1 VERSION
25              
26             Version v1.4.3
27              
28             =cut
29              
30             our $VERSION = "v1.4.3";
31              
32             declare WorldName, as LowerCaseSimpleStr,
33             coercion => 1,
34             message {'Must be a single lowercase word'};
35              
36             declare DataDir, as Dir, coercion => 1, message {
37             'Must be an existing directory containing directories for boxer classes and/or boxer nodes';
38             };
39              
40             declare ClassDir, as Dir,
41             coercion => 1,
42             message {'Must be an existing directory containing boxer classes'};
43              
44             declare NodeDir, as Dir,
45             coercion => 1,
46             message {'Must be an existing directory containing boxer nodes'};
47              
48             declare SkelDir, as Dir,
49             coercion => 1,
50             message {'Must be an existing directory containing boxer skeleton files'};
51              
52             declare Basename, as NonEmptySimpleStr,
53             where { $_ eq path($_)->basename },
54             message {'Must be a bare filename with no directory parts'};
55              
56             declare Suite, as LowerCaseSimpleStr,
57             coercion => 1,
58             message {'Must be a single lowercase word'};
59              
60             my $SerializationList = "Type::Tiny"->new(
61             name => 'SerializationList',
62             parent =>
63             Tuple [ slurpy ArrayRef [ StrMatch [qr{^(?:preseed|script)$}] ] ],
64             );
65             declare SerializationList,
66             as $SerializationList->plus_coercions( Split [qr/[^a-z]+/] ),
67             coercion => 1,
68             message {'Must be one or more of these words: preseed script'};
69              
70             =head1 AUTHOR
71              
72             Jonas Smedegaard C<< >>.
73              
74             =cut
75              
76             our $AUTHORITY = 'cpan:JONASS';
77              
78             =head1 COPYRIGHT AND LICENCE
79              
80             Copyright © 2013-2016 Jonas Smedegaard
81              
82             This is free software; you can redistribute it and/or modify it under
83             the same terms as the Perl 5 programming language system itself.
84              
85             =head1 DISCLAIMER OF WARRANTIES
86              
87             THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
88             WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
89             MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
90              
91             =cut
92              
93             1;