Promise/Headers/Cookie.pm

filter: Statementstmt 100% 31 / 31 Branchbran 62.5% 5 / 8 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 9 / 9 Podpod 100% 3 / 3 totaltotal 89.2% 50 / 56 CC 6 SCAR 11.7
CC
6
Cov
90%
init
6.2
BEGIN
1.0
BEGIN
1.0
CRAP 3.2
« Promise/Headers/KeepAlive.pm ↑ Summary Promise/Headers/Forwarded.pm »
1 ##----------------------------------------------------------------------------
2 ## Asynchronous HTTP Request and Promise - ~/lib/HTTP/Promise/Headers/Cookie.pm
3 ## Version v0.1.0
4 ## Copyright(c) 2022 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2022/05/07
7 ## Modified 2022/05/07
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::Cookie;
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 3 ▶{
Subroutine init: called CC=6 SCAR=18.3
Pod documented
29 3 my $self = shift( @_ );
30 3 $self->{cookies} = [];
31 3 ▶ @_ = () if( @_ == 1 && $self->_is_a( $_[0] => 'Module::Generic::Null' ) );
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 and $self->_is_a($_[0], "Module::Generic::Null") 0 3 3
Condition66%2/3
@_ == 1 and $self->_is_a($_[0], "Module::Generic::Null")
!ll&&!rl&&r
120
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
32 3 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 2 1 3
33 {
34 2 my $this = shift( @_ );
35 2 ▶ my $ref = $self->_is_array( $this ) ? $this : [split( /(?<!\\)\;[[:blank:]\h]*/, $this )];
Branch: 1 branch
BranchTrueFalseTotal
$self->_is_array($this) ? : 0 2 2
36 2 $self->cookies( $ref );
37 }
38 3 $self->{_init_strict_use_sub} = 1;
39 3 ▶ $self->SUPER::init( @_ ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init(@_) or return $self->pass_error 3 0 3
40 3 $self->_field_name( 'Cookie' );
41 3 return( $self );
42 }
43  
44 4 ▶sub as_string { return( shift->cookies->join( '; ' )->scalar ); }
Subroutine as_string: called CC=1 SCAR=0.0
Pod documented
45  
46 10 ▶sub cookies { return( shift->_set_get_array_as_object( 'cookies', @_ ) ); }
Subroutine cookies: called CC=1 SCAR=0.0
Pod documented
47  
48 3 1;
49 # NOTE: POD
50 __END__
« Promise/Headers/KeepAlive.pm ↑ Summary Promise/Headers/Forwarded.pm »