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