| 1 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | package MetaPOD::Format::JSON::interface::v1_1; | ||||||||||||||||||||||||||||
| 5 | 5 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 5 | $MetaPOD::Format::JSON::interface::v1_1::AUTHORITY = 'cpan:KENTNL'; | |||||||||||||||||||||||||||
| 7 | } | ||||||||||||||||||||||||||||
| 8 | { | ||||||||||||||||||||||||||||
| 9 | 5 | $MetaPOD::Format::JSON::interface::v1_1::VERSION = '0.3.0'; | |||||||||||||||||||||||||||
| 10 | } | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | # ABSTRACT: Implementation of JSON/interface format component | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 5 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 5 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | ▶ | sub supported_interfaces { | ||||||||||||||||||||||||||
|
Subroutine
supported_interfaces: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 20 | 0 | return qw( class role type_library exporter single_class function ); | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | sub check_interface { | ||||||||||||||||||||||||||
|
Subroutine
check_interface: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 25 | 0 | my ( $self, @ifs ) = @_; | |||||||||||||||||||||||||||
| 26 | 0 | my $supported = { map { ( $_, 1 ) } $self->supported_interfaces_v1_1 }; | |||||||||||||||||||||||||||
| 27 | 0 | for my $if (@ifs) { | |||||||||||||||||||||||||||
| 28 | 0 | ▶ | if ( not exists $supported->{$if} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 0 | croak("interface type $if unsupported in v1.1.0"); | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | 0 | return $self; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 9 | ▶ | sub add_interface { | ||||||||||||||||||||||||||
|
Subroutine
add_interface: called CC=5 SCAR=26.2
Pod
documented
| |||||||||||||||||||||||||||||
| 37 | 9 | my ( $self, $interface, $result ) = @_; | |||||||||||||||||||||||||||
| 38 | 9 | ▶ | if ( defined $interface and not ref $interface ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $interface and not ref $interface
MC/DC0%0/2
defined $interface and not ref $interface
defined $interface
not ref $interface
Truth table33%1/3
A and not(B)
A= defined $interfaceB= not ref $interface
| |||||||||||||||||||||||||||||
| 39 | 9 | return $result->add_interface($interface); | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | 0 | ▶ | if ( defined $interface and ref $interface eq 'ARRAY' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $interface and ref $interface eq "ARRAY"
MC/DC0%0/2
defined $interface and ref $interface eq "ARRAY"
defined $interface
ref $interface eq "ARRAY"
Truth table0%0/3
A and B
A= defined $interfaceB= ref $interface eq "ARRAY"
| |||||||||||||||||||||||||||||
| 42 | 0 | return $result->add_interface( @{$interface} ); | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | 0 | croak 'Unsupported reftype ' . ref $interface; | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 5 | 1; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | __END__ | ||||||||||||||||||||||||||||