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.030;
2             # ABSTRACT: dzil-specific type library
3              
4 52     52   436 use Dist::Zilla::Pragmas;
  52         149  
  52         542  
5              
6 52     52   405 use namespace::autoclean;
  52         149  
  52         463  
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         411 use MooseX::Types -declare => [qw(
19             License OneZero YesNoStr ReleaseStatus
20             Path ArrayRefOfPaths
21             _Filename
22 52     52   7339 )];
  52         152512  
23 52     52   401127 use MooseX::Types::Moose qw(Str Int Defined ArrayRef);
  52         71851  
  52         447  
24 52     52   326536 use Path::Tiny;
  52         576750  
  52         36691  
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.030
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 released
80             in the last two to three years. (That is, if the most recently released
81             version is v5.40, then this module should work on both v5.40 and v5.38.)
82              
83             Although it may work on older versions of perl, no guarantee is made that the
84             minimum required version will not be increased. The version may be increased
85             for any reason, and there is no promise that patches will be accepted to lower
86             the minimum required perl.
87              
88             =head1 AUTHOR
89              
90             Ricardo SIGNES 😏 <cpan@semiotic.systems>
91              
92             =head1 COPYRIGHT AND LICENSE
93              
94             This software is copyright (c) 2023 by Ricardo SIGNES.
95              
96             This is free software; you can redistribute it and/or modify it under
97             the same terms as the Perl 5 programming language system itself.
98              
99             =cut