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