File Coverage

blib/lib/Benchmark/Featureset/ParamCheck/Implementation/TypeParams/TypeNano.pm
Criterion Covered Total %
statement 28 28 100.0
branch n/a
condition n/a
subroutine 11 11 100.0
pod 0 2 0.0
total 39 41 95.1


line stmt bran cond sub pod time code
1 4     4   11677 use v5.12;
  4         16  
2 4     4   25 use strict;
  4         11  
  4         78  
3 4     4   19 use warnings;
  4         11  
  4         217  
4              
5              
6             our $AUTHORITY = 'cpan:TOBYINK';
7             our $VERSION = '0.006';
8              
9             use parent qw(Benchmark::Featureset::ParamCheck::Base);
10 4     4   25 use Type::Params 1.016004 qw(compile_named compile);
  4         21  
  4         22  
11 4     4   239 use Type::Nano qw( Int ArrayRef HashRef duck_type );
  4         52  
  4         21  
12 4     4   2426 use namespace::autoclean;
  4         8752  
  4         24  
13 4     4   2381  
  4         13  
  4         24  
14             use constant long_name => 'Type::Params with Type::Nano';
15 4     4   226 use constant short_name => 'TP-Nano';
  4         10  
  4         223  
16 4     4   26  
  4         11  
  4         695  
17             my $ArrayRef_of_HashRef = Type::Nano->new(
18             name => 'ArrayRef[HashRef]',
19             parent => ArrayRef,
20             constraint => sub { HashRef->check($_) || return !!0 for @$_; !!1 },
21             );
22              
23             state $check = compile_named(
24             integer => Int,
25 58     58 0 198 hashes => $ArrayRef_of_HashRef,
26             object => duck_type [qw/ print close /],
27             );
28             }
29              
30             state $check = compile(
31             Int,
32             $ArrayRef_of_HashRef,
33 47     47 0 160 duck_type [qw/ print close /],
34             );
35             }
36              
37             1;