MetaPOD/Role/Format.pm

filter: Statementstmt 87.8% 29 / 33 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 100% 2 / 2 totaltotal 88.0% 44 / 50 CC 5 SCAR 9.7
CC
5
Cov
87%
supports_version
5.1
_supported_versions
2.0
BEGIN
1.0
CRAP 2.6
« MetaPOD/Extractor.pm ↑ Summary MetaPOD/Result.pm »
1 3 ▶use 5.006; # our
Subroutine BEGIN: called CC=1 SCAR=0.0
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package MetaPOD::Role::Format;
6  
7 3 our $VERSION = 'v0.4.0';
8  
9 # ABSTRACT: Base role for common format routines
10  
11 3 our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
12  
13 3 ▶use Moo::Role qw( requires );
Subroutine BEGIN: called CC=1 SCAR=0.0
14 3 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 ▶use version 0.77;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42 10 ▶sub supported_versions { return qw( v1.0.0 ) }
Subroutine supported_versions: called CC=1 SCAR=0.0
Pod documented
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54 0 ▶sub _supported_versions {
Subroutine _supported_versions: not called CC=1 SCAR=6.9
55 0 my $class = shift;
56 0 return map { version->parse($_) } $class->supported_versions;
57 }
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71 13 ▶sub supports_version {
Subroutine supports_version: called CC=5 SCAR=16.2
Pod documented
72 13 my ( $class, $version ) = @_;
73 13 ▶ return [ $class->supported_versions ]->[-1] if not defined $version;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $version 1 12 13
74 12 ▶ if ( $version !~ /^v/msx ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($version =~ /^v/msx) 0 12 12
75 0 croak q{Version specification does not begin with a 'v'};
76 }
77 12 my $v = version->parse($version);
78 12 for my $supported ( $class->supported_versions ) {
79 17 ▶ return $supported if $supported == $v;
Branch: 1 branch
BranchTrueFalseTotal
if $supported == $v 6 11 17
80 }
81 6 croak "Version $v not supported. Supported versions: " . join q{,}, $class->supported_versions;
82 }
83  
84 3 requires 'add_segment';
85  
86 3 1;
87  
88 __END__
« MetaPOD/Extractor.pm ↑ Summary MetaPOD/Result.pm »