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   93 use v5.14;
  6         28  
8 6     6   40 use utf8;
  6         13  
  6         40  
9 6     6   186 use Role::Commons -all;
  6         12  
  6         51  
10 6     6   11723 use namespace::autoclean;
  6         36  
  6         51  
11              
12 6     6   1353 use Path::Tiny;
  6         11614  
  6         441  
13              
14 6         48 use Type::Library -base, -declare => qw(
15 6     6   42 WorldName DataDir ClassDir NodeDir SkelDir Basename Suite SerializationList );
  6         13  
16 6     6   10735 use Type::Utils;
  6         30096  
  6         58  
17 6     6   9323 use Types::Standard qw( ArrayRef Split Str Tuple StrMatch slurpy );
  6         13  
  6         27  
18 6     6   10153 use Types::Common::String qw( NonEmptySimpleStr LowerCaseSimpleStr );
  6         258400  
  6         89  
19 6     6   6958 use Types::Path::Tiny qw(Dir);
  6         104908  
  6         52  
20              
21 6     6   2493 use strictures 2;
  6         65  
  6         267  
22 6     6   1399 no warnings "experimental::signatures";
  6         13  
  6         2861  
23              
24             =head1 VERSION
25              
26             Version v1.4.1
27              
28             =cut
29              
30             our $VERSION = "v1.4.1";
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<< <dr@jones.dk> >>.
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;