blib/lib/MooseX/Types/PerlVersion.pm

filter: Statementstmt 96.3% 26 / 27 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.0% 9 / 10 Podpod n/a totaltotal 94.5% 35 / 37 CC 1 SCAR 0.1
CC
1
Cov
96%
__ANON__
1.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
↑ Summary
1 package MooseX::Types::PerlVersion;
2  
3 # ABSTRACT: L<Perl::Version> type for Moose classes
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = '0.002';
9  
10 1 ▶use MooseX::Types -declare => [qw(PerlVersion)];
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use MooseX::Types::Moose qw(Num Str);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Perl::Version;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 class_type 'Perl::Version';
16  
17 subtype PerlVersion,
18 as 'Perl::Version',
19 6 ▶ where { $_ =~ Perl::Version::REGEX },
Subroutine __ANON__: called CC=1 SCAR=0.0
20 0 ▶ message { 'Must be a valid Perl version' };
Subroutine __ANON__: not called CC=1 SCAR=1.2
21  
22 coerce PerlVersion,
23 2 ▶ from Num, via { Perl::Version->new($_) },
Subroutine __ANON__: called CC=1 SCAR=0.0
24 2 ▶ from Str, via { Perl::Version->new($_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
25  
26 1 1; # eof
27  
28  
29  
30 =pod
31  
32 =head1 NAME
33  
34 MooseX::Types::PerlVersion - L<Perl::Version> type for Moose classes
35  
36 =head1 VERSION
37  
38 version 0.002
39  
40 =head1 SYNOPSIS
41  
42 use MooseX::Types::PerlVersion qw(PerlVersion);
43  
44 has version => (
45 is => 'ro',
46 isa => PerlVersion,
47 coerce => 1,
48 );
49  
50 =head1 DESCRIPTION
51  
52 This package provides Moose types for L<Perl::Version>. It also provides
53 coercion from C<Str> and C<Num> Moose types.
54  
55 =head1 EXPORT
56  
57 None by default, you'll usually want to request C<PerlVersion> explicitly.
58  
59 =head1 SEE ALSO
60  
61 =over 4
62  
63 =item L<Perl::Version>
64  
65 =item L<Moose::Util::TypeConstraints>
66  
67 =item L<Moose>
68  
69 =back
70  
71 =cut
72  
73 =head1 AUTHOR
74  
75 Roman F. <romanf@cpan.org>
76  
77 =head1 COPYRIGHT AND LICENSE
78  
79 This software is copyright (c) 2012 by Roman F..
80  
81 This is free software; you can redistribute it and/or modify it under
82 the same terms as the Perl 5 programming language system itself.
83  
84 =cut
85  
86  
87 __END__
↑ Summary