API/Role/Format.pm

filter: Statementstmt 100% 22 / 22 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 93.9% 31 / 33 CC 2 SCAR 2.3
CC
2
Cov
96%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« API/Role/UserAgent.pm ↑ Summary API/Parser/JSON.pm »
1 package Net::HTTP::API::Role::Format;
2 4 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 $Net::HTTP::API::Role::Format::VERSION = '0.14';
4 }
5  
6 # ABSTRACT: Set appropriate format to request header
7  
8 4 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 ▶sub content_type {
Subroutine content_type: called CC=1 SCAR=0.0
Pod documented
12 3 { json => {value => 'application/json', module => 'JSON',},
13 yaml => {value => 'text/x-yaml', module => 'YAML'},
14 xml => {value => 'text/xml', module => 'XML::Simple'},
15 };
16 }
17  
18 3 ▶subtype Format => as 'Str' => where {
Subroutine __ANON__: called CC=1 SCAR=0.0
19 3 my $format = shift;
20 3 grep {/^$format$/} keys %{content_type()};
21 4 };
22  
23 4 enum 'FormatMode' => qw(content-type append);
24  
25 has api_format => (
26 is => 'rw',
27 isa => 'Format',
28 lazy => 1,
29 3 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
30 3 my $self = shift;
31 3 $self->meta->get_api_option('api_format');
32 }
33 4 );
34  
35 has api_format_mode => (
36 is => 'rw',
37 isa => 'FormatMode',
38 lazy => 1,
39 3 ▶ default => sub {
Subroutine __ANON__: called CC=2 SCAR=7.1
40 3 my $self = shift;
41 3 ▶ my $mode = $self->meta->get_api_option('api_format_mode') || 'append';
Condition50%1/2
$self->meta->get_api_option('api_format_mode') || 'append'
l!l
03
MC/DC0%0/1
$self->meta->get_api_option('api_format_mode') || 'append'
$self->meta->get_api_option('api_format_mode')
Truth table50%1/2
A
A= $self->meta->get_api_option('api_format_mode')
Aresult
11
00
42 3 $mode;
43 }
44 4 );
45  
46 4 1;
47  
48  
49 __END__
« API/Role/UserAgent.pm ↑ Summary API/Parser/JSON.pm »