File Coverage

blib/lib/Data/Validate/CSV/Types.pm
Criterion Covered Total %
statement 22 22 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 30 30 100.0


line stmt bran cond sub pod time code
1 2     2   28 use v5.12;
  2         7  
2 2     2   15 use strict;
  2         4  
  2         39  
3 2     2   10 use warnings;
  2         3  
  2         163  
4              
5             package Data::Validate::CSV::Types;
6              
7             our $AUTHORITY = 'cpan:TOBYINK';
8             our $VERSION = '0.003';
9              
10 2         20 use Type::Library -base, -declare => qw(
11             Table
12             Row
13             Cell
14             Column
15             Schema
16             Note
17             SingleValueCell
18             MultiValueCell
19 2     2   1057 );
  2         49046  
20              
21             BEGIN {
22 2     2   3615 require Type::Utils;
23 2         9748 Type::Utils::extends(qw( Types::Standard ));
24             };
25              
26 2     2   132682 use Types::Path::Tiny qw( Path );
  2         60842  
  2         19  
27 2     2   890 use Type::Tiny::Class ();
  2         5  
  2         33  
28 2     2   948 use Type::Tiny::Role ();
  2         1930  
  2         409  
29              
30             __PACKAGE__->add_type(Type::Tiny::Class->new(
31             name => Table,
32             class => 'Data::Validate::CSV::Table',
33             ));
34              
35             __PACKAGE__->add_type(Type::Tiny::Class->new(
36             name => Note,
37             class => 'Data::Validate::CSV::Note',
38             coercion => [
39             HashRef, q{ 'Data::Validate::CSV::Note'->new($_) },
40             ],
41             ));
42              
43             __PACKAGE__->add_type(Type::Tiny::Class->new(
44             name => Schema,
45             class => 'Data::Validate::CSV::Schema',
46             coercion => [
47             HashRef, q{ 'Data::Validate::CSV::Schema'->new_from_hashref($_) },
48             Str|ScalarRef, q{ 'Data::Validate::CSV::Schema'->new_from_json($_) },
49             Path, q{ 'Data::Validate::CSV::Schema'->new_from_file($_) },
50             ],
51             ));
52              
53             __PACKAGE__->add_type(Type::Tiny::Class->new(
54             name => Column,
55             class => 'Data::Validate::CSV::Column',
56             coercion => [
57             HashRef, q{ 'Data::Validate::CSV::Column'->new($_) },
58             ],
59             ));
60              
61             __PACKAGE__->add_type(Type::Tiny::Class->new(
62             name => Row,
63             class => 'Data::Validate::CSV::Row',
64             ));
65              
66             __PACKAGE__->add_type(Type::Tiny::Role->new(
67             name => Cell,
68             role => 'Data::Validate::CSV::Cell',
69             ));
70              
71             __PACKAGE__->add_type(Type::Tiny::Class->new(
72             name => SingleValueCell,
73             class => 'Data::Validate::CSV::SingleValueCell',
74             ));
75              
76             __PACKAGE__->add_type(Type::Tiny::Class->new(
77             name => MultiValueCell,
78             class => 'Data::Validate::CSV::MultiValueCell',
79             ));
80              
81             __PACKAGE__->make_immutable;
82              
83             1;