File Coverage

lib/MooseX/ShortCut/BuildInstance/Types.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 23 23 100.0


line stmt bran cond sub pod time code
1             package MooseX::ShortCut::BuildInstance::Types;
2             our $AUTHORITY = 'cpan:JANDREW';
3 2     2   514778 use version; our $VERSION = version->declare('v1.44.2');
  2         1570  
  2         18  
4 2     2   175 use 5.010;
  2         7  
5 2     2   510 use utf8;
  2         10  
  2         10  
6 2     2   56 use MooseX::Types::Moose qw( Str ArrayRef HashRef CodeRef ClassName RoleName );
  2         2  
  2         22  
7 2     2   9567 use MooseX::Types::Structured qw( Optional Dict );
  2         647168  
  2         14  
8 2         13 use MooseX::Types -declare => [qw(
9             NameSpace SuperClassesList RolesList
10             Attributes Methods BuildClassDict
11 2     2   726 )];
  2         4  
12            
13             #########1 Package Variables 3#########4#########5#########6#########7#########8#########9
14              
15              
16              
17             #########1 Type Library 3#########4#########5#########6#########7#########8#########9
18              
19             subtype NameSpace, as Str,
20             where{ $_ =~ /^[A-Za-z:]+$/ },
21             message{ "-$_- does not match: " . qr/^[A-Za-z:]+$/ };
22            
23             subtype SuperClassesList, as ArrayRef[ ClassName ],
24             where{ scalar( @$_ ) > 0 };
25            
26             subtype RolesList, as ArrayRef[ RoleName ],
27             where{ scalar( @$_ ) > 0 };
28            
29             subtype Attributes, as HashRef[ HashRef ],
30             where{ scalar( keys %$_ ) > 0 };
31            
32             subtype Methods, as HashRef[ CodeRef ],
33             where{ scalar( keys %$_ ) > 0 };
34            
35             subtype BuildClassDict, as Dict[
36             package => Optional[ NameSpace ],
37             superclasses => Optional[ SuperClassesList ],
38             roles => Optional[ RolesList ],
39             add_roles_in_sequence => Optional[ RolesList ],
40             add_attributes => Optional[ Attributes ],
41             add_methods => Optional[ Methods ],
42             ],
43             where{ scalar( keys( %$_ ) ) > 0 };
44              
45             #########1 Declared Coercions 3#########4#########5#########6#########7#########8#########9
46              
47              
48              
49             #########1 Private Methods 3#########4#########5#########6#########7#########8#########9
50              
51              
52              
53             #########1 Phinish 3#########4#########5#########6#########7#########8#########9
54            
55             1;
56              
57             #########1 Documentation 3#########4#########5#########6#########7#########8#########9
58             __END__
59              
60             =head1 NAME
61              
62             MooseX::ShortCut::BuildInstance::Types - The BuildInstance type library
63            
64             =head1 DESCRIPTION
65              
66             This is the package for managing types in the L<MooseX::ShortCut::BuildInstance>
67             package.
68              
69             =head2 L<Caveat utilitor|http://en.wiktionary.org/wiki/Appendix:List_of_Latin_phrases_(A%E2%80%93E)#C>
70              
71             All type tests included with this package are considered to be the fixed definition of
72             the types. Any definition not included in the testing is considered flexible.
73              
74             =head2 Types
75              
76             These are checks from the L<Moose> typing system. They are used to see
77             if passed information is compatible with some standard.
78            
79             =head3 NameSpace
80              
81             =over
82              
83             B<Test:> to see if the name_space fits classical package nameing conventions
84              
85             B<Accepts:> $string =~ /^[A-Za-z:]+$/
86              
87             =back
88            
89             =head3 SuperClassesList
90              
91             =over
92              
93             B<Test:> Checking for an arrayref of classes suitable for inheritance by the built class
94              
95             B<Accepts:> an array ref of class names
96              
97             =back
98            
99             =head3 RolesList
100              
101             =over
102              
103             B<Test:> Checking for an arrayref of role suitable for adding to the built class
104              
105             B<Accepts:> an array ref of role names
106              
107             =back
108            
109             =head3 Attributes
110              
111             =over
112              
113             B<Test:> This is a hash ref of attributes to be added to the built class
114              
115             B<Accepts:> the hash keys will be treated as the attribute names and the values
116             will be treated as the attribute settings. Only HashRefs are accepted as values
117             but no testing of the HashRef for suitability as attribute settings is done prior
118             to implementation by $meta-E<gt>add_attribute( $value ).
119              
120             =back
121            
122             =head3 Methods
123              
124             =over
125              
126             B<Test:> This is a hash ref of methods to be added to the built class
127              
128             B<Accepts:> the hash keys will be treated as the method names and the values
129             will be treated as method refs. Only CodeRefs are accepted as values
130             but no testing of the CodeRefs for suitability as methods is done prior
131             to implementation by $meta-E<gt>add_method( $value ).
132              
133             =back
134            
135             =head3 BuildClassDict
136              
137             =over
138              
139             B<Test:> This is a Dictionary ref defining the possible entrys to the
140             'build_class' function
141              
142             B<Accepts:>
143              
144             Dict[# Moose doesn't have a Dict type so the guts are different
145             package => Optional[ NameSpace ],
146             superclasses => Optional[ SuperClassesList ],
147             roles => Optional[ RolesList ],
148             add_roles_in_sequence => Optional[ RolesList ],
149             add_attributes => Optional[ Attributes ],
150             add_methods => Optional[ Methods ],
151             ]
152              
153             =back
154              
155             =head1 SUPPORT
156              
157             =over
158              
159             L<MooseX-ShortCut-BuildInstance/issues|https://github.com/jandrew/MooseX-ShortCut-BuildInstance/issues>
160              
161             =back
162              
163             =head1 TODO
164              
165             =over
166              
167             B<1.> Nothing L<currently|/SUPPORT>
168              
169             =back
170              
171             =head1 AUTHOR
172              
173             =over
174              
175             =item Jed Lund
176              
177             =item jandrew@cpan.org
178              
179             =back
180              
181             =head1 COPYRIGHT
182              
183             This program is free software; you can redistribute
184             it and/or modify it under the same terms as Perl itself.
185              
186             The full text of the license can be found in the
187             LICENSE file included with this module.
188              
189             This software is copyrighted (c) 2014 and 2016 by Jed Lund
190              
191             =head1 DEPENDENCIES
192              
193             =over
194              
195             L<version>
196              
197             L<utf8>
198              
199             L<MooseX::Types>
200              
201             L<MooseX::Types::Moose>
202              
203             =back
204              
205             =cut
206              
207             #########1#########2 main pod documentation end 5#########6#########7#########8#########9