File Coverage

lib/Net/EGTS/Types.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1 14     14   78 use utf8;
  14         32  
  14         127  
2              
3             package Net::EGTS::Types;
4 14     14   444 use Mouse;
  14         20  
  14         94  
5 14     14   4591 use Mouse::Util::TypeConstraints;
  14         25  
  14         95  
6 14     14   1493 use namespace::autoclean;
  14         13417  
  14         103  
7              
8             =head1 NAME
9              
10             Net::EGTS::Types - Data types.
11              
12             =cut
13              
14             subtype 'BOOLEAN', as 'Bool';
15             subtype 'BYTE', as 'Int', where { 0 <= $_ && $_ < 2 ** 8 };
16             subtype 'USHORT', as 'Int', where { 0 <= $_ && $_ < 2 ** 16 };
17             subtype 'UINT', as 'Int', where { 0 <= $_ && $_ < 2 ** 32 };
18             subtype 'ULONG', as 'Int', where { 0 <= $_ && $_ < 2 ** 64 };
19             subtype 'SHORT', as 'Int', where { -(2 ** 15) <= $_ && $_ < 2 ** 15 };
20             subtype 'INT', as 'Int', where { -(2 ** 31) <= $_ && $_ < 2 ** 31 };
21             subtype 'FLOAT', as 'Num';
22             subtype 'DOUBLE', as 'Num';
23             subtype 'STRING', as 'Str';
24             subtype 'BINARY', as 'Str';
25              
26             subtype 'BINARY3', as 'Str';#, where { length($_) == 3 };
27              
28             subtype 'BIT1', as 'Bool';
29             subtype 'BIT2', as 'Int', where { 0 <= $_ && $_ < 2 ** 2 };
30             subtype 'BIT3', as 'Int', where { 0 <= $_ && $_ < 2 ** 3 };
31             subtype 'BIT4', as 'Int', where { 0 <= $_ && $_ < 2 ** 4 };
32             subtype 'BIT5', as 'Int', where { 0 <= $_ && $_ < 2 ** 5 };
33             subtype 'BIT6', as 'Int', where { 0 <= $_ && $_ < 2 ** 6 };
34             subtype 'BIT7', as 'Int', where { 0 <= $_ && $_ < 2 ** 7 };
35             subtype 'BIT8', as 'Int', where { 0 <= $_ && $_ < 2 ** 8 };
36              
37             __PACKAGE__->meta->make_immutable();