lib/MetaPOD/Format/JSON.pm

filter: Statementstmt 97.2% 35 / 36 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 100% 2 / 2 totaltotal 98.0% 49 / 50 CC 3 SCAR 4.1
CC
3
Cov
97%
add_segment
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« blib/lib/MetaPOD/Format/JSON/v1.pm ↑ Summary lib/MetaPOD/Format/JSON/PostCheck/v1.pm »
1 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package MetaPOD::Format::JSON;
5 3 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 $MetaPOD::Format::JSON::AUTHORITY = 'cpan:KENTNL';
7 }
8 {
9 3 $MetaPOD::Format::JSON::VERSION = '0.3.0';
10 }
11  
12 # ABSTRACT: Reference implementation of a C<JSON> based MetaPOD Format
13  
14  
15 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 3 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
17 3 ▶use version 0.77;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 3 with 'MetaPOD::Role::Format';
20  
21 3 ▶use MetaPOD::Format::JSON::v1;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 3 ▶use MetaPOD::Format::JSON::v1_1;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 3 my $dispatch_table = [
25 {
26 version => version->parse('v1.0.0'),
27 handler => 'MetaPOD::Format::JSON::v1'
28 },
29 {
30 version => version->parse('v1.1.0'),
31 handler => 'MetaPOD::Format::JSON::v1_1'
32 }
33 ];
34  
35  
36 26 ▶sub supported_versions {
Subroutine supported_versions: called CC=1 SCAR=0.0
Pod documented
37 26 return qw( v1.0.0 v1.1.0 );
38 }
39  
40  
41 13 ▶sub add_segment {
Subroutine add_segment: called CC=3 SCAR=11.0
Pod documented
42 13 my ( $self, $segment, $result ) = @_;
43 13 my $segver = $self->supports_version( $segment->{version} );
44 13 for my $v ( @{$dispatch_table} ) {
45 22 ▶ next unless $v->{version} == $segver;
Branch: 1 branch
BranchTrueFalseTotal
unless $v->{"version"} == $segver 9 13 22
46 13 $v->{handler}->add_segment( $segment, $result );
47 13 return $result;
48 }
49 0 croak "No implementation found for version $segver";
50 }
51  
52 3 1;
53  
54 __END__
« blib/lib/MetaPOD/Format/JSON/v1.pm ↑ Summary lib/MetaPOD/Format/JSON/PostCheck/v1.pm »