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             $Types::RENEEB::VERSION = '0.09';
3             # ABSTRACT: Several predefined Type::Tiny types
4              
5 6     6   562568 use v5.10;
  6         84  
6              
7 6     6   37 use strict;
  6         12  
  6         120  
8 6     6   28 use warnings;
  6         18  
  6         261  
9              
10 6     6   3373 use Type::Library -base;
  6         213845  
  6         73  
11 6     6   5991 use Type::Utils ();
  6         56011  
  6         300  
12              
13             Type::Utils::extends(qw/Types::OTRS 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.09
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             OTRSVersion OTRSVersionWildcard
42             );
43              
44             has distname => ( is => 'ro', isa => DistName );
45             has distversion => ( is => 'ro', isa => DistVersion );
46             has otrs_version => ( is => 'ro', isa => OTRSVersion );
47              
48             sub check_otrs_version {
49             OTRSVersion->('2.0.0');
50             }
51              
52             sub check_otrs_version {
53             OTRSVersion->('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::OTRS>
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::OTRS
128              
129             =head3 OTRSVersion
130              
131             An OTRS version looks like 2.4.5 or 6.0.1.
132              
133             =head3 OTRSVersionWildcard
134              
135             An OTRS version with wildcard as used in Addons. To define a version of the OTRS framework
136             that is needed to install the addon, the developer can use 'x' as a wildcard.
137              
138             E.g. Addons for OTRS 6.x can be installed on any OTRS 6 installation, whilst addons that
139             define 2.4.x as the framework version can only installed on any OTRS 2.4 installation, but
140             not on OTRS 2.3 installation.
141              
142             =head3 OPMFile
143              
144             An object of L<OTRS::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 OTRS::OPM::Parser
155              
156             When a string is given, it is coerced into an L<OTRS::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