File Coverage

blib/lib/Spreadsheet/Reader/Format/Types.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod n/a
total 26 26 100.0


line stmt bran cond sub pod time code
1             package Spreadsheet::Reader::Format::Types;
2             our $AUTHORITY = 'cpan:JANDREW';
3 3     3   99945 use version; our $VERSION = version->declare('v0.6.4');
  3         1360  
  3         25  
4             #~ use Log::Shiras::Unhide qw( :debug );
5             ###LogSD warn "You uncovered internal logging statements for Spreadsheet::Reader::Format::Types-$VERSION";
6            
7 3     3   256 use strict;
  3         4  
  3         53  
8 3     3   27 use warnings;
  3         3  
  3         84  
9 3     3   412 use Type::Utils -all;
  3         14155  
  3         28  
10             use Type::Library 1.000
11 3         20 -base,
12             -declare => qw(
13             NegativeNum ZeroOrUndef NotNegativeNum
14             PositiveNum Excel_number_0
15 3     3   5520 );#
  3         74  
16 3     3   3338 use IO::File;
  3         2972  
  3         303  
17 3     3   29 BEGIN{ extends "Types::Standard" };
18             my $try_xs =
19             exists($ENV{PERL_TYPE_TINY_XS}) ? !!$ENV{PERL_TYPE_TINY_XS} :
20             exists($ENV{PERL_ONLY}) ? !$ENV{PERL_ONLY} :
21             1;
22             if( $try_xs and exists $INC{'Type/Tiny/XS.pm'} ){
23             eval "use Type::Tiny::XS 0.010";
24             if( $@ ){
25             die "You have loaded Type::Tiny::XS but versions prior to 0.010 will cause this module to fail";
26             }
27             }
28              
29             #########1 Package Variables 3#########4#########5#########6#########7#########8#########9
30              
31              
32              
33             #########1 Type Library 3#########4#########5#########6#########7#########8#########9
34              
35             declare PositiveNum,
36             as Num,
37             where{ $_ > 0 };
38              
39             declare NegativeNum,
40             as Num,
41             where{ $_ < 0 };
42            
43             declare ZeroOrUndef,
44             as Maybe[Num],
45             where{ !$_ };
46            
47             declare NotNegativeNum,
48             as Num,
49             where{ $_ > -1 };
50              
51              
52             #########1 Excel Defined Converions 4#########5#########6#########7#########8#########9
53              
54             declare_coercion Excel_number_0,
55             to_type Any, from Maybe[Any],
56             via{ $_ };
57              
58             #########1 Public Attributes 3#########4#########5#########6#########7#########8#########9
59              
60              
61              
62             #########1 Private Methods 3#########4#########5#########6#########7#########8#########9
63            
64              
65             #########1 Phinish 3#########4#########5#########6#########7#########8#########9
66              
67             __PACKAGE__->meta->make_immutable;
68             1;
69              
70             #########1 Documentation 3#########4#########5#########6#########7#########8#########9
71             __END__
72              
73             =head1 NAME
74              
75             Spreadsheet::Reader::Format::Types - A type library for Spreadsheet readers
76            
77             =head1 DESCRIPTION
78              
79             Not written yet
80              
81             =head1 TYPES
82              
83             =head2 PositiveNum
84              
85             This type checks that the value is a number and is greater than 0
86              
87             =head3 coercions
88              
89             none
90              
91             =head2 NegativeNum
92              
93             This type checks that the value is a number and is less than 0
94              
95             =head3 coercions
96              
97             none
98              
99             =head2 ZeroOrUndef
100              
101             This type allows the value to be the number 0 or undef
102              
103             =head3 coercions
104              
105             none
106              
107             =head2 NotNegativeNum
108              
109             This type checks that the value is a number and that the number is greater than
110             or equal to 0
111              
112             =head3 coercions
113              
114             none
115              
116             =head1 NAMED COERCIONS
117              
118             =head2 Excel_number_0
119              
120             This is essentially a pass through coercion used as a convenience rather than writing the
121             pass through each time a coercion is needed but no actual work should be performed on the
122             value
123              
124             =head1 SUPPORT
125              
126             =over
127              
128             L<github Spreadsheet::Reader::Format/issues
129             |https://github.com/jandrew/p5-spreadsheet-reader-format/issues>
130              
131             =back
132              
133             =head1 TODO
134              
135             =over
136              
137             B<1.> Nothing yet
138              
139             =back
140              
141             =head1 AUTHOR
142              
143             =over
144              
145             =item Jed Lund
146              
147             =item jandrew@cpan.org
148              
149             =back
150              
151             =head1 COPYRIGHT
152              
153             This program is free software; you can redistribute
154             it and/or modify it under the same terms as Perl itself.
155              
156             The full text of the license can be found in the
157             LICENSE file included with this module.
158              
159             This software is copyrighted (c) 2016 by Jed Lund
160              
161             =head1 DEPENDENCIES
162              
163             =over
164              
165             L<Type::Tiny> - 1.000
166              
167             =back
168              
169             =head1 SEE ALSO
170              
171             =over
172              
173             L<Spreadsheet::ParseExcel>
174              
175             =back
176              
177             =cut
178              
179             #########1#########2 main pod documentation end 5#########6#########7#########8#########9