File Coverage

blib/lib/Dist/Zilla/Types.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             # ABSTRACT: dzil-specific type library
2              
3             use Dist::Zilla::Pragmas;
4 52     52   421  
  52         146  
  52         509  
5             use namespace::autoclean;
6 52     52   377  
  52         132  
  52         419  
7             #pod =head1 OVERVIEW
8             #pod
9             #pod This library provides L<MooseX::Types> types for use by Dist::Zilla. These
10             #pod types are not (yet?) for public consumption, and you should not rely on them.
11             #pod
12             #pod Dist::Zilla uses a number of types found in L<MooseX::Types::Perl>. Maybe
13             #pod that's what you want.
14             #pod
15             #pod =cut
16              
17             use MooseX::Types -declare => [qw(
18 52         421 License OneZero YesNoStr ReleaseStatus
19             Path ArrayRefOfPaths
20             _Filename
21             )];
22 52     52   7095 use MooseX::Types::Moose qw(Str Int Defined ArrayRef);
  52         149833  
23 52     52   391751 use Path::Tiny;
  52         70488  
  52         424  
24 52     52   315864  
  52         542870  
  52         35215  
25             subtype License, as class_type('Software::License');
26              
27             subtype Path, as class_type('Path::Tiny');
28             coerce Path, from Defined, via {
29             require Dist::Zilla::Path;
30             Dist::Zilla::Path::path($_);
31             };
32              
33             subtype ArrayRefOfPaths, as ArrayRef[Path];
34             coerce ArrayRefOfPaths, from ArrayRef[Defined], via {
35             require Dist::Zilla::Path;
36             [ map { Dist::Zilla::Path::path($_) } @$_ ];
37             };
38              
39             subtype OneZero, as Str, where { $_ eq '0' or $_ eq '1' };
40              
41             subtype YesNoStr, as Str, where { /\A(?:y|ye|yes)\Z/i or /\A(?:n|no)\Z/i };
42              
43             subtype ReleaseStatus, as Str, where { /\A(?:stable|testing|unstable)\z/ };
44              
45             coerce OneZero, from YesNoStr, via { /\Ay/i ? 1 : 0 };
46              
47             subtype _Filename, as Str,
48             where { $_ !~ qr/(?:\x{0a}|\x{0b}|\x{0c}|\x{0d}|\x{85}|\x{2028}|\x{2029})/ },
49             message { "Filename not a Str, or contains a newline or other vertical whitespace" };
50              
51             1;
52              
53              
54             =pod
55              
56             =encoding UTF-8
57              
58             =head1 NAME
59              
60             Dist::Zilla::Types - dzil-specific type library
61              
62             =head1 VERSION
63              
64             version 6.028
65              
66             =head1 OVERVIEW
67              
68             This library provides L<MooseX::Types> types for use by Dist::Zilla. These
69             types are not (yet?) for public consumption, and you should not rely on them.
70              
71             Dist::Zilla uses a number of types found in L<MooseX::Types::Perl>. Maybe
72             that's what you want.
73              
74             =head1 PERL VERSION
75              
76             This module should work on any version of perl still receiving updates from
77             the Perl 5 Porters. This means it should work on any version of perl released
78             in the last two to three years. (That is, if the most recently released
79             version is v5.40, then this module should work on both v5.40 and v5.38.)
80              
81             Although it may work on older versions of perl, no guarantee is made that the
82             minimum required version will not be increased. The version may be increased
83             for any reason, and there is no promise that patches will be accepted to lower
84             the minimum required perl.
85              
86             =head1 AUTHOR
87              
88             Ricardo SIGNES 😏 <cpan@semiotic.systems>
89              
90             =head1 COPYRIGHT AND LICENSE
91              
92             This software is copyright (c) 2022 by Ricardo SIGNES.
93              
94             This is free software; you can redistribute it and/or modify it under
95             the same terms as the Perl 5 programming language system itself.
96              
97             =cut