| 1 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 2 | ## Asynchronous HTTP Request and Promise - ~/lib/HTTP/Promise/Headers/CacheControl.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::CacheControl; | ||||||||||||||||||||||||||||
| 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 | 4 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=7 SCAR=19.6
Pod
documented
| |||||||||||||||||||||||||||||
| 29 | 4 | my $self = shift( @_ ); | |||||||||||||||||||||||||||
| 30 | 4 | $self->{properties} = {}; | |||||||||||||||||||||||||||
| 31 | 4 | $self->{params} = []; | |||||||||||||||||||||||||||
| 32 | 4 | $self->{_needs_quotes} = {}; | |||||||||||||||||||||||||||
| 33 | 4 | ▶ | @_ = () 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")
| |||||||||||||||||||||||||||||
| 34 | 4 | ▶ | if( @_ ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | { | ||||||||||||||||||||||||||||
| 36 | 3 | my $this = shift( @_ ); | |||||||||||||||||||||||||||
| 37 | 3 | ▶ | my $ref = $self->new_array( $self->_is_array( $this ) ? $this : [split( /[[:blank:]\h]*(?<!\\)\,[[:blank:]\h]*/, "$this" )] ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | 3 | my $params = $self->params; | |||||||||||||||||||||||||||
| 39 | 3 | my $props = $self->properties; | |||||||||||||||||||||||||||
| 40 | 3 | foreach my $pair ( @$ref ) | |||||||||||||||||||||||||||
| 41 | { | ||||||||||||||||||||||||||||
| 42 | 5 | my( $prop, $val ) = split( /=/, $pair, 2 ); | |||||||||||||||||||||||||||
| 43 | 5 | $props->{ $prop } = $val; | |||||||||||||||||||||||||||
| 44 | 5 | $params->push( $prop ); | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | 4 | $self->{_init_strict_use_sub} = 1; | |||||||||||||||||||||||||||
| 48 | 4 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 4 | $self->_field_name( 'Cache-Control' ); | |||||||||||||||||||||||||||
| 50 | 4 | return( $self ); | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 9 | ▶ | sub as_string { return( shift->_set_get_properties_as_string ); } | ||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 2 | ▶ | sub immutable { return( shift->_set_get_property_boolean( 'immutable', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
immutable: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 6 | ▶ | sub max_age { return( shift->_set_get_property_number( 'max-age', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
max_age: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 0 | ▶ | sub max_stale { return( shift->_set_get_property_number( 'max-stale', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
max_stale: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | ▶ | sub min_fresh { return( shift->_set_get_property_number( 'min-fresh', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
min_fresh: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | sub must_revalidate { return( shift->_set_get_property_boolean( 'must-revalidate', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
must_revalidate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | ▶ | sub must_understand { return( shift->_set_get_property_boolean( 'must-understand', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
must_understand: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 0 | ▶ | sub no_cache { return( shift->_set_get_property_boolean( 'no-cache', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
no_cache: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub no_store { return( shift->_set_get_property_boolean( 'no-store', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
no_store: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | ▶ | sub no_transform { return( shift->_set_get_property_boolean( 'no-transform', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
no_transform: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 0 | ▶ | sub only_if_cached { return( shift->_set_get_property_boolean( 'only-if-cached', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
only_if_cached: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 26 | ▶ | sub params { return( shift->_set_get_array_as_object( 'params', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
params: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 3 | ▶ | sub property { return( shift->_set_get_property_value( @_, ( @_ > 1 ? { needs_quotes => 1 } : () ) ) ); } | ||||||||||||||||||||||||||
|
Subroutine
property: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 26 | ▶ | sub properties { return( shift->_set_get_hash_as_mix_object( 'properties', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
properties: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 0 | ▶ | sub private { return( shift->_set_get_property_boolean( 'private', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
private: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 0 | ▶ | sub proxy_revalidate { return( shift->_set_get_property_boolean( 'proxy-revalidate', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
proxy_revalidate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 1 | ▶ | sub public { return( shift->_set_get_property_boolean( 'public', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
public: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 0 | ▶ | sub s_maxage { return( shift->_set_get_property_number( 's-maxage', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
s_maxage: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 0 | ▶ | sub stale_if_error { return( shift->_set_get_property_number( 'stale-if-error', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
stale_if_error: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 0 | ▶ | sub stale_while_revalidate { return( shift->_set_get_property_number( 'stale-while-revalidate', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
stale_while_revalidate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 10 | ▶ | sub _needs_quotes { return( shift->_set_get_hash_as_mix_object( '_needs_quotes', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
_needs_quotes: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 3 | 1; | |||||||||||||||||||||||||||
| 96 | # NOTE: POD | ||||||||||||||||||||||||||||
| 97 | __END__ | ||||||||||||||||||||||||||||