| 1 | # ABSTRACT: HiD type constraints | ||
| 2 | |||
| 3 | |||
| 4 | package HiD::Types; | ||
| 5 | 28 | our $AUTHORITY = 'cpan:GENEHACK'; | |
| 6 | 28 | $HiD::Types::VERSION = '1.96'; | |
| 7 | 28 | ▶ | use 5.014; # strict, unicode_strings |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 28 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 28 | ▶ | use autodie; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 28 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 28 | ▶ | use warnings qw/ FATAL utf8 /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 28 | ▶ | use open qw/ :std :utf8 /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 28 | ▶ | use charnames qw/ :full /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | 28 | ▶ | use Moose::Util::TypeConstraints; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | subtype 'HiD_DirPath' | ||
| 18 | => as 'Str' | ||
| 19 | 217 | ▶ | => where { -d $_ }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 20 | |||
| 21 | # TODO make this a bit more useful? | ||
| 22 | 28 | subtype 'HiD_FileExtension' | |
| 23 | => as 'Str' , | ||
| 24 | #=> where { what, exactly? } | ||
| 25 | ; | ||
| 26 | |||
| 27 | subtype 'HiD_FilePath' | ||
| 28 | => as 'Str' | ||
| 29 | 149 | ▶ | => where { -f $_ }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 30 | |||
| 31 | subtype 'HiD_PosInt' | ||
| 32 | => as 'Int' | ||
| 33 | 0 | ▶ | => where { $_ > 0 } |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 34 | 0 | ▶ | => message { "Must be positive integer." }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 35 | |||
| 36 | 28 | class_type 'HiD_Post' , { class => 'HiD::Post' }; | |
| 37 | |||
| 38 | ### FIXME delete if after 13 Nov 2014 | ||
| 39 | 28 | class_type 'deprecated_HiD_Plugin_class' , { class => 'HiD::Plugin'}; | |
| 40 | |||
| 41 | 28 | role_type 'HiD_Plugin' , { role => 'HiD::Plugin'}; | |
| 42 | 28 | role_type 'HiD_Generator' , { role => 'HiD::Generator'}; | |
| 43 | |||
| 44 | 28 | union 'Pluginish' , [qw/ | |
| 45 | deprecated_HiD_Plugin_class | ||
| 46 | HiD_Plugin | ||
| 47 | HiD_Generator | ||
| 48 | / ]; | ||
| 49 | |||
| 50 | 28 | ▶ | no Moose::Util::TypeConstraints; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 51 | 28 | 1; | |
| 52 | |||
| 53 | __END__ | ||
| 54 | |||
| 55 | =pod | ||
| 56 | |||
| 57 | =encoding UTF-8 | ||
| 58 | |||
| 59 | =head1 NAME | ||
| 60 | |||
| 61 | HiD::Types - HiD type constraints | ||
| 62 | |||
| 63 | =head1 DESCRIPTION | ||
| 64 | |||
| 65 | Type constraints for HiD. | ||
| 66 | |||
| 67 | =head1 VERSION | ||
| 68 | |||
| 69 | version 1.96 | ||
| 70 | |||
| 71 | =head1 AUTHOR | ||
| 72 | |||
| 73 | John SJ Anderson <genehack@genehack.org> | ||
| 74 | |||
| 75 | =head1 COPYRIGHT AND LICENSE | ||
| 76 | |||
| 77 | This software is copyright (c) 2015 by John SJ Anderson. | ||
| 78 | |||
| 79 | This is free software; you can redistribute it and/or modify it under | ||
| 80 | the same terms as the Perl 5 programming language system itself. | ||
| 81 | |||
| 82 | =cut | ||