File Coverage

blib/lib/Data/Walk/Extracted/Types.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 24 24 100.0


line stmt bran cond sub pod time code
1             package Data::Walk::Extracted::Types;
2             our $AUTHORITY = 'cpan:JANDREW';
3 5     5   16 use version; our $VERSION = version->declare('v0.26.16');
  5         7  
  5         33  
4 5     5   425 use strict;
  5         7  
  5         77  
5 5     5   15 use warnings;
  5         5  
  5         104  
6 5     5   28 use Type::Utils -all;
  5         5  
  5         40  
7             use Type::Library
8 5         31 -base,
9             -declare => qw(
10             PosInt
11 5     5   9004 );
  5         6  
12 5     5   1435 use Types::Standard -types;
  5         6  
  5         29  
13              
14             #########1 SubType Library 3#########4#########5#########6#########7#########8#########9
15              
16             declare PosInt, as Int,
17             where{ $_ >= 0 },
18             message{ "$_ is not a positive integer" };
19              
20             #########1 private methods 3#########4#########5#########6#########7#########8#########9
21              
22              
23              
24             #########1 Phinish strong 3#########4#########5#########6#########7#########8#########9
25              
26             1;
27             # The preceding line will help the module return a true value
28              
29             #########1 main pod docs 3#########4#########5#########6#########7#########8#########9
30              
31             __END__
32              
33             =head1 NAME
34              
35             Data::Walk::Extracted::Types - A type library for Data::Walk::Extracted
36              
37             =head1 SYNOPSIS
38              
39             package Data::Walk::Extracted::MyRole;
40             use Moose::Role;
41             use Data::Walk::Extracted::Types qw(
42             posInt
43             );
44             use Log::Shiras::Types qw(
45             posInt #See Code for other options
46             );
47              
48             has 'someattribute' =>(
49             isa => posInt,#Note the lack of quotes
50             );
51              
52             sub valuetestmethod{
53             my ( $self, $value ) = @_;
54             return is_posInt( $value );
55             }
56              
57             no Moose::Role;
58              
59             1;
60              
61             =head1 DESCRIPTION
62              
63             This is the custom type class that ships with the L<Data::Walk::Extracted
64             |https://metacpan.org/module/Data::Walk::Extracted> package. Wherever
65             possible errors to coersions are passed back to the type so coersion failure
66             will be explained.
67              
68             There are only subtypes in this package! B<WARNING> These types should be
69             considered in a beta state. Future type fixing will be done with a set of tests in
70             the test suit of this package. (currently none are implemented)
71              
72             See L<MooseX::Types|https://metacpan.org/module/MooseX::Types> for general re-use
73             of this module.
74              
75             =head1 Types
76              
77             =head2 posInt
78              
79             =over
80              
81             B<Definition: >all integers equal to or greater than 0
82              
83             B<Coercions: >no coersion available
84              
85             =back
86              
87             =head1 TODO
88              
89             =over
90              
91             B<1.> write a test suit for the types to permanently define behavior!
92              
93             B<2.> Add L<Log::Shiras|https://metacpan.org/module/Log::Shiras> debugging statements
94              
95             =back
96              
97             =head1 SUPPORT
98              
99             L<github Data-Walk-Extracted/issues|https://github.com/jandrew/Data-Walk-Extracted/issues>
100              
101             =head1 AUTHOR
102              
103             =over
104              
105             Jed Lund
106              
107             jandrew@cpan.com
108              
109             =back
110              
111             =head1 COPYRIGHT
112              
113             This program is free software; you can redistribute
114             it and/or modify it under the same terms as Perl itself.
115              
116             The full text of the license can be found in the
117             LICENSE file included with this module.
118              
119             =head1 DEPENDENCIES
120              
121             =over
122              
123             L<version|https://metacpan.org/module/version>
124              
125             L<MooseX::Types|https://metacpan.org/module/MooseX::Types>
126              
127             L<MooseX::Types::Moose|https://metacpan.org/module/MooseX::Types::Moose>
128              
129             =back
130              
131             =head1 SEE ALSO
132              
133             =over
134              
135             L<MooseX::Types::Perl|https://metacpan.org/module/MooseX::Types::Perl>
136              
137             =back
138              
139             =cut
140              
141             #########1 Main POD ends 3#########4#########5#########6#########7#########8#########9