| 1 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 2 | ## Asynchronous HTTP Request and Promise - ~/lib/HTTP/Promise/Headers/Accept.pm | ||||||||||||||||||||||||||||
| 3 | ## Version v0.1.0 | ||||||||||||||||||||||||||||
| 4 | ## Copyright(c) 2022 DEGUEST Pte. Ltd. | ||||||||||||||||||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||||||||||||||||||||
| 6 | ## Created 2022/05/06 | ||||||||||||||||||||||||||||
| 7 | ## Modified 2022/05/06 | ||||||||||||||||||||||||||||
| 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::Accept; | ||||||||||||||||||||||||||||
| 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 | 20 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=8 SCAR=22.1
Pod
documented
| |||||||||||||||||||||||||||||
| 29 | 20 | my $self = shift( @_ ); | |||||||||||||||||||||||||||
| 30 | 20 | $self->{_qv_elements} = []; | |||||||||||||||||||||||||||
| 31 | 20 | ▶ | @_ = () if( @_ == 1 && $self->_is_a( $_[0] => 'Module::Generic::Null' ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@_ == 1 and $self->_is_a($_[0], "Module::Generic::Null")
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")
| |||||||||||||||||||||||||||||
| 32 | 20 | ▶ | if( @_ ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | { | ||||||||||||||||||||||||||||
| 34 | 15 | my $val = shift( @_ ); | |||||||||||||||||||||||||||
| 35 | 15 | ▶ | return( $self->error( "No value was provided." ) ) if( !defined( $val ) || !length( $val ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $val and length $val
MC/DC0%0/2
defined $val and length $val
defined $val
length $val
Truth table33%1/3
A and B
A= defined $valB= length $val
| |||||||||||||||||||||||||||||
| 36 | 15 | ▶ | my $choices = $self->_parse_quality_value( $val ) || | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->_parse_quality_value($val) || (return $self->pass_error)
MC/DC0%0/1
$self->_parse_quality_value($val) || (return $self->pass_error)
$self->_parse_quality_value($val)
Truth table50%1/2
A
A= $self->_parse_quality_value($val)
| |||||||||||||||||||||||||||||
| 37 | return( $self->pass_error ); | ||||||||||||||||||||||||||||
| 38 | 15 | $self->elements( $choices ); | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | 20 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 20 | $self->_field_name( 'Accept' ); | |||||||||||||||||||||||||||
| 42 | 20 | return( $self ); | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub add { return( shift->_qv_add( @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
add: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 25 | ▶ | sub as_string { return( shift->_qv_as_string( @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 64 | ▶ | sub elements { return( shift->_qv_elements( @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
elements: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 5 | ▶ | sub get { return( shift->_qv_get( @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub match { return( shift->_qv_match( @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
match: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 1 | ▶ | sub remove { return( shift->_qv_remove( @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
remove: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 1 | ▶ | sub sort { return( shift->_qv_sort( @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
sort: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 3 | 1; | |||||||||||||||||||||||||||
| 60 | # NOTE: POD | ||||||||||||||||||||||||||||
| 61 | __END__ | ||||||||||||||||||||||||||||