File Coverage

blib/lib/Types/RENEEB.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 19 19 100.0


line stmt bran cond sub pod time code
1             package Types::RENEEB;
2              
3             # ABSTRACT: Several predefined Type::Tiny types
4              
5 6     6   538354 use v5.10;
  6         69  
6              
7 6     6   34 use strict;
  6         22  
  6         127  
8 6     6   38 use warnings;
  6         20  
  6         262  
9              
10 6     6   3075 use Type::Library -base;
  6         226863  
  6         60  
11 6     6   4656 use Type::Utils ();
  6         59042  
  6         292  
12              
13             Type::Utils::extends(qw/Types::OPM Types::Dist/);
14              
15             1;
16              
17             __END__
18              
19             =pod
20              
21             =encoding UTF-8
22              
23             =head1 NAME
24              
25             Types::RENEEB - Several predefined Type::Tiny types
26              
27             =head1 VERSION
28              
29             version 0.10
30              
31             =head1 SYNOPSIS
32              
33             package TypesTest;
34              
35             use strict;
36             use warnings;
37              
38             use Moo;
39             use Types::RENEEB qw(
40             DistName DistVersion
41             OPMVersion OPMVersionWildcard
42             );
43              
44             has distname => ( is => 'ro', isa => DistName );
45             has distversion => ( is => 'ro', isa => DistVersion );
46             has opm_version => ( is => 'ro', isa => OPMVersion );
47              
48             sub check_opm_version {
49             OPMVersion->('2.0.0');
50             }
51              
52             sub check_opm_version {
53             OPMVersion->('2.0.x');
54             }
55              
56             1;
57              
58             =head1 DESCRIPTION
59              
60             C<Types::RENEEB> is a collection of types I need very often
61              
62             =head1 MODULES
63              
64             These C<Types::> modules are shipped in this distribution:
65              
66             =over 4
67              
68             =item * L<Types::Dist>
69              
70             =item * L<Types::OPM>
71              
72             =back
73              
74             C<Types::RENEEB> inherits the types of the mentioned modules.
75              
76             =head2 Types::Dist
77              
78             =head3 DistFQ
79              
80             I<DistName>-I<DistVersion>
81              
82             package MyClass;
83              
84             use Moo;
85             use Types::Dist qw(DistName);
86              
87             has dist => ( is => 'ro', isa => DistName );
88              
89             1;
90              
91             And then use your class:
92              
93             my $object = MyClass->new( dist => 'Types-RENEEB-0.09' );
94             my $object = MyClass->new( dist => '0.09' ); # fails
95             my $object = MyClass->new( dist => 'Types-RENEEB' ); # fails
96              
97             =head3 DistName
98              
99             A name of a distribution
100              
101             my $object = MyClass->new( dist => 'Types-RENEEB' ); # ok
102              
103             =head3 DistVersion
104              
105             A version of a distribution
106              
107             my $object = MyClass->new( dist => '0.09' ); # ok
108              
109             =head3 CPANfile
110              
111             An instance of L<Module::CPANfile>
112              
113             package MyClass;
114              
115             use Moo;
116             use Types::Dist qw(CPANfile);
117              
118             has prereqs => ( is => 'ro', isa => CPANfile, coerce => 1 );
119              
120             1;
121              
122             And then use your class:
123              
124             my $object = MyClass->new( prereqs => '/path/to/cpanfile' );
125             my @features = $object->prereqs->features; # call features method from Module::CPANfile
126              
127             =head2 Types::OPM
128              
129             =head3 OPMVersion
130              
131             An OPM version looks like 2.4.5 or 6.0.1.
132              
133             =head3 OPMVersionWildcard
134              
135             An OPM version with wildcard as used in Addons. To define a version of the OPM framework
136             that is needed to install the addon, the developer can use 'x' as a wildcard.
137              
138             E.g. Addons for OPM 6.x can be installed on any OPM 6 installation, whilst addons that
139             define 2.4.x as the framework version can only installed on any OPM 2.4 installation, but
140             not on OPM 2.3 installation.
141              
142             =head3 OPMFile
143              
144             An object of L<OPM::Parser>.
145              
146             It checks if the file exists and can be parsed without an error.
147              
148             =head3 COERCIONS
149              
150             =head4 OPMFile
151              
152             =over 4
153              
154             =item * From String to OPM::Parser
155              
156             When a string is given, it is coerced into an L<OPM::Parser> object.
157              
158             =back
159              
160             =head1 AUTHOR
161              
162             Renee Baecker <reneeb@cpan.org>
163              
164             =head1 COPYRIGHT AND LICENSE
165              
166             This software is Copyright (c) 2019 by Renee Baecker.
167              
168             This is free software, licensed under:
169              
170             The Artistic License 2.0 (GPL Compatible)
171              
172             =cut