File Coverage

blib/lib/Data/Walk/Extracted/Types.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod n/a
total 27 27 100.0


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