File Coverage

blib/lib/Types/PerlVersion.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 24 24 100.0


line stmt bran cond sub pod time code
1             package Types::PerlVersion;
2              
3 2     2   75724 use strict;
  2         3  
  2         53  
4 2     2   7 use warnings;
  2         2  
  2         88  
5              
6             =head1 NAME
7              
8             Types::PerlVersion - L type constraint for L
9              
10             =head1 VERSION
11              
12             Version 0.002
13              
14             =cut
15              
16             our $VERSION = '0.002';
17              
18             =head1 SYNOPSIS
19              
20             package MyApp::Thingie;
21              
22             use Moose;
23             use Types::PerlVersion qw/PerlVersion/;
24              
25             has version => (
26             is => 'ro',
27             isa => PerlVersion,
28             coerce => 1,
29             required => 1,
30             );
31              
32             =head1 DESCRIPTION
33              
34             L is a type constraint suitable for use with
35             L/L attributes that need to deal with version strings as
36             handled by L.
37              
38             =head2 Types
39              
40             This module provides the single type constraint C. Coercion is
41             provided from C and C types.
42              
43             =cut
44              
45 2     2   377 use Type::Library -base, -declare => qw( PerlVersion );
  2         17650  
  2         13  
46 2     2   2133 use Type::Utils -all;
  2         5931  
  2         14  
47 2     2   4228 use Types::Standard qw/Num Str/;
  2         27240  
  2         13  
48 2     2   2002 use Perl::Version;
  2         3257  
  2         163  
49              
50             class_type PerlVersion, { class => "Perl::Version" };
51              
52             coerce PerlVersion,
53             from Num, via { "Perl::Version"->new($_) },
54             from Str, via { "Perl::Version"->new($_) };
55              
56             =head1 AUTHOR
57              
58             Peter Mottram (SysPete), C<< >>
59              
60             =head1 BUGS
61              
62             Please report any bugs found to:
63              
64             L
65              
66             =head1 SUPPORT
67              
68             You can find documentation for this module with the perldoc command.
69              
70             perldoc Types::PerlVersion
71              
72             You can also look for information at:
73              
74             =over 4
75              
76             =item * L
77              
78             =item * L
79              
80             =back
81              
82             =head1 SEE ALSO
83              
84             If you prefer to use L then see L
85             which was the basis of this module.
86              
87             =head1 ACKNOWLEDGEMENTS
88              
89             Toby Inkster for his excellent L, brian d foy for L
90             and Roman F. for L from which I stole most of the
91             code for this module.
92              
93             =head1 LICENSE AND COPYRIGHT
94              
95             Copyright 2015 Peter Mottram (SysPete).
96              
97             This program is free software; you can redistribute it and/or modify
98             it under the same terms as the Perl 5 programming language system itself.
99              
100             =cut
101              
102             1; # End of Types::PerlVersion