Promise/Headers/ServerTiming.pm

filter: Statementstmt 92.0% 46 / 50 Branchbran 62.5% 10 / 16 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 84.6% 11 / 13 Podpod 100% 7 / 7 totaltotal 83.5% 76 / 91 CC 11 SCAR 14.5
CC
11
Cov
84%
init
8.6
name
4.1
param
2.0
CRAP 4.3
« Promise/Stream/Base64.pm ↑ Summary Promise/Headers/Accept.pm »
1 ##----------------------------------------------------------------------------
2 ## Asynchronous HTTP Request and Promise - ~/lib/HTTP/Promise/Headers/ServerTiming.pm
3 ## Version v0.1.0
4 ## Copyright(c) 2022 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2022/05/08
7 ## Modified 2022/05/08
8 ## All rights reserved.
9 ##
10 ##
11 ## This program is free software; you can redistribute it and/or modify it
12 ## under the same terms as Perl itself.
13 ##----------------------------------------------------------------------------
14 package HTTP::Promise::Headers::ServerTiming;
15 BEGIN
16 3 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
17 3 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 3 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 3 warnings::register_categories( 'HTTP::Promise' );
20 3 ▶ use parent qw( HTTP::Promise::Headers::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
21 3 our $VERSION = 'v0.1.0';
22 };
23  
24 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 sub init
28 5 ▶{
Subroutine init: called CC=8 SCAR=21.5
Pod documented
29 5 my $self = shift( @_ );
30 5 ▶ @_ = () if( @_ == 1 && $self->_is_a( $_[0] => 'Module::Generic::Null' ) );
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 and $self->_is_a($_[0], "Module::Generic::Null") 0 5 5
Condition66%2/3
@_ == 1 and $self->_is_a($_[0], "Module::Generic::Null")
!ll&&!rl&&r
230
MC/DC0%0/2
@_ == 1 and $self->_is_a($_[0], "Module::Generic::Null")
@_ == 1 $self->_is_a($_[0], "Module::Generic::Null")
Truth table66%2/3
A and B
A= @_ == 1B= $self->_is_a($_[0], "Module::Generic::Null")
ABresult
0X0
100
111
31 5 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 3 2 5
32 {
33 3 my $this = shift( @_ );
34 3 my $hv;
35 3 ▶ if( index( $this, ';' ) != -1 )
Branch: 1 branch
BranchTrueFalseTotal
if (index($this, ';') != -1) { } 3 0 3
36 {
37 3 $hv = $self->_parse_header_value( $this );
38 }
39 else
40 {
41 0 $hv = $self->_new_hv( $this );
42 }
43 3 ▶ return( $self->pass_error ) if( !defined( $hv ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $hv 0 3 3
44 3 my $opts = $self->_get_args_as_hash( @_ );
45 3 $hv->param( $_ => $opts->{ $_ } ) for( keys( %$opts ) );
46 3 $self->_hv( $hv );
47 }
48 5 $self->{_init_strict_use_sub} = 1;
49 5 ▶ $self->SUPER::init( @_ ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init(@_) or return $self->pass_error 5 0 5
50 5 $self->_field_name( 'Server-Timing' );
51 5 return( $self );
52 }
53  
54 6 ▶sub as_string { return( shift->_hv_as_string( @_ ) ); }
Subroutine as_string: called CC=1 SCAR=0.0
Pod documented
55  
56 5 ▶sub desc { return( shift->_set_get_param( 'desc', @_ ) ); }
Subroutine desc: called CC=1 SCAR=0.0
Pod documented
57  
58 5 ▶sub dur { return( shift->_set_get_param( 'dur', @_ ) ); }
Subroutine dur: called CC=1 SCAR=0.0
Pod documented
59  
60 sub name
61 5 ▶{
Subroutine name: called CC=4 SCAR=14.1
Pod documented
62 5 my $self = shift( @_ );
63 5 my $hv = $self->_hv;
64 5 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 1 4 5
65 {
66 1 my $this = shift( @_ );
67 1 ▶ if( $hv )
Branch: 1 branch
BranchTrueFalseTotal
if ($hv) { } 0 1 1
68 {
69 0 $hv->value( $this );
70 }
71 else
72 {
73 1 $hv = $self->_new_hv( $this );
74 1 $self->_hv( $hv );
75 }
76 1 return( $this);
77 }
78 else
79 {
80 4 ▶ return( '' ) if( !$hv );
Branch: 1 branch
BranchTrueFalseTotal
unless $hv 0 4 4
81 4 return( $hv->value_data );
82 }
83 }
84  
85 0 ▶sub param { return( shift->_set_get_param( @_ ) ); }
Subroutine param: not called CC=1 SCAR=6.9
Pod documented
86  
87 0 ▶sub params { return( shift->_set_get_params( @_ ) ); }
Subroutine params: not called CC=1 SCAR=6.9
Pod documented
88  
89 3 1;
90 # NOTE: POD
91 __END__
« Promise/Stream/Base64.pm ↑ Summary Promise/Headers/Accept.pm »