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