File Coverage

blib/lib/MetaCPAN/Client/Types.pm
Criterion Covered Total %
statement 25 26 96.1
branch 1 2 50.0
condition n/a
subroutine 13 14 92.8
pod 6 6 100.0
total 45 48 93.7


line stmt bran cond sub pod time code
1 21     21   142 use strict;
  21         42  
  21         620  
2 21     21   113 use warnings;
  21         42  
  21         931  
3             package MetaCPAN::Client::Types;
4             # ABSTRACT: type checking helper class
5             $MetaCPAN::Client::Types::VERSION = '2.029000';
6 21     21   13091 use Type::Tiny ();
  21         336137  
  21         779  
7 21     21   13127 use Types::Standard ();
  21         1230226  
  21         968  
8 21     21   935 use Ref::Util qw< is_ref >;
  21         1028  
  21         1206  
9              
10 21     21   10009 use parent 'Exporter';
  21         6577  
  21         144  
11             our @EXPORT_OK = qw< Str Int Time ArrayRef HashRef Bool >;
12              
13 103     103 1 436 sub Str { Types::Standard::Str }
14 40     40 1 273 sub Int { Types::Standard::Int }
15 41     41 1 320 sub ArrayRef { Types::Standard::ArrayRef }
16 61     61 1 300 sub HashRef { Types::Standard::HashRef }
17 21     21 1 147 sub Bool { Types::Standard::Bool }
18              
19             sub Time {
20             return Type::Tiny->new(
21             name => "Time",
22 11 50   11   2595 constraint => sub { !is_ref($_) and /^[1-9][0-9]*(?:s|m|h)$/ },
23 0     0   0 message => sub { "$_ is not in time format (e.g. '5m')" },
24 21     21 1 268 );
25             }
26              
27             1;
28              
29             __END__