| 1 | package GDPR::IAB::TCFv2::Parser 0.512; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 72 | ▶ | use v5.12; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 72 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 72 | ▶ | use integer; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 72 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 72 | ▶ | use Carp qw<carp croak>; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 72 | ▶ | use MIME::Base64 qw<decode_base64>; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 72 | ▶ | use POSIX qw<strftime>; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 72 | ▶ | use GDPR::IAB::TCFv2::BitField; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 72 | use GDPR::IAB::TCFv2::BitUtils qw<is_set | |||||||||||||||||||||||||||||||||||||||||
| 14 | get_uint3 | ||||||||||||||||||||||||||||||||||||||||||
| 15 | get_uint6 | ||||||||||||||||||||||||||||||||||||||||||
| 16 | get_uint12 | ||||||||||||||||||||||||||||||||||||||||||
| 17 | get_uint16 | ||||||||||||||||||||||||||||||||||||||||||
| 18 | get_uint36 | ||||||||||||||||||||||||||||||||||||||||||
| 19 | get_char6_pair | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 72 | ▶ | >; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 72 | ▶ | use GDPR::IAB::TCFv2::Publisher; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 72 | ▶ | use GDPR::IAB::TCFv2::RangeSection; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 72 | ▶ | use GDPR::IAB::TCFv2::Constants::RestrictionType qw<:all>; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | use constant { | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 72 | CONSENT_STRING_TCF_V2 => {SEPARATOR => quotemeta q<.>, PREFIX => q<C>, MIN_BYTE_SIZE => 29,}, | |||||||||||||||||||||||||||||||||||||||||
| 27 | EXPECTED_TCF_V2_VERSION => 2, | ||||||||||||||||||||||||||||||||||||||||||
| 28 | MAX_SPECIAL_FEATURE_ID => 12, | ||||||||||||||||||||||||||||||||||||||||||
| 29 | MAX_PURPOSE_ID => 24, | ||||||||||||||||||||||||||||||||||||||||||
| 30 | DATE_FORMAT_ISO_8601 => '%Y-%m-%dT%H:%M:%SZ', | ||||||||||||||||||||||||||||||||||||||||||
| 31 | TCF_V23_DEADLINE => 1772236800, # 2026-02-28T00:00:00Z | ||||||||||||||||||||||||||||||||||||||||||
| 32 | SEGMENT_TYPES => {CORE => 0, DISCLOSED_VENDORS => 1, ALLOWED_VENDORS => 2, PUBLISHER_TC => 3,}, | ||||||||||||||||||||||||||||||||||||||||||
| 33 | OFFSETS => { | ||||||||||||||||||||||||||||||||||||||||||
| 34 | SEGMENT_TYPE => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 35 | VERSION => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 36 | CREATED => 6, | ||||||||||||||||||||||||||||||||||||||||||
| 37 | LAST_UPDATED => 42, | ||||||||||||||||||||||||||||||||||||||||||
| 38 | CMP_ID => 78, | ||||||||||||||||||||||||||||||||||||||||||
| 39 | CMP_VERSION => 90, | ||||||||||||||||||||||||||||||||||||||||||
| 40 | CONSENT_SCREEN => 102, | ||||||||||||||||||||||||||||||||||||||||||
| 41 | CONSENT_LANGUAGE => 108, | ||||||||||||||||||||||||||||||||||||||||||
| 42 | VENDOR_LIST_VERSION => 120, | ||||||||||||||||||||||||||||||||||||||||||
| 43 | POLICY_VERSION => 132, | ||||||||||||||||||||||||||||||||||||||||||
| 44 | SERVICE_SPECIFIC => 138, | ||||||||||||||||||||||||||||||||||||||||||
| 45 | USE_NON_STANDARD_STACKS => 139, | ||||||||||||||||||||||||||||||||||||||||||
| 46 | SPECIAL_FEATURE_OPT_IN => 140, | ||||||||||||||||||||||||||||||||||||||||||
| 47 | PURPOSE_CONSENT_ALLOWED => 152, | ||||||||||||||||||||||||||||||||||||||||||
| 48 | PURPOSE_LIT_ALLOWED => 176, | ||||||||||||||||||||||||||||||||||||||||||
| 49 | PURPOSE_ONE_TREATMENT => 200, | ||||||||||||||||||||||||||||||||||||||||||
| 50 | PUBLISHER_COUNTRY_CODE => 201, | ||||||||||||||||||||||||||||||||||||||||||
| 51 | VENDOR_CONSENT => 213, | ||||||||||||||||||||||||||||||||||||||||||
| 52 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 72 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 72 | ▶ | use overload q<""> => \&tc_string; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | # ABSTRACT: gdpr iab tcf v2.3 consent string parser | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | sub Parse { | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 11440 | ▶ | my ($klass, $tc_string, %opts) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Parse: called CC=14 SCAR=26.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 11440 | ▶ | croak 'missing gdpr consent string' unless defined $tc_string && length $tc_string; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $tc_string and length $tc_string
MC/DC100%2/2
defined $tc_string and length $tc_string
defined $tc_string
length $tc_string
Truth table100%3/3
A and B
A= defined $tc_stringB= length $tc_string
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 11438 | my $segments = _decode_tc_string_segments($tc_string); | |||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 11427 | my $strict = !!$opts{strict}; | |||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 11427 | ▶ | my %options = (json => $opts{json} // {}, strict => $strict, reference_time => $opts{reference_time},); | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$opts{"json"} // {}
MC/DC100%1/1
$opts{"json"} // {}
$opts{"json"}
Truth table100%2/2
A
A= $opts{"json"}
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 11427 | ▶ | $options{json}->{date_format} ||= DATE_FORMAT_ISO_8601; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$options{"json"}{"date_format"} ||= "%Y-%m-%dT%H:%M:%SZ"
MC/DC100%1/1
$options{"json"}{"date_format"} ||= "%Y-%m-%dT%H:%M:%SZ"
$options{"json"}{"date_format"}
Truth table100%2/2
A
A= $options{"json"}{"date_format"}
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 11427 | ▶ | $options{json}->{boolean_values} ||= [_json_false(), _json_true()]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$options{"json"}{"boolean_values"} ||= [_json_false(), _json_true()]
MC/DC100%1/1
$options{"json"}{"boolean_values"} ||= [_json_false(), _json_true()]
$options{"json"}{"boolean_values"}
Truth table100%2/2
A
A= $options{"json"}{"boolean_values"}
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 11427 | ▶ | if (exists $opts{prefetch}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | my $prefetch = $opts{prefetch}; | |||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 1 | ▶ | $prefetch = [$prefetch] if ref($prefetch) ne ref([]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 1 | $options{prefetch} = $prefetch; | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | my $self = { | ||||||||||||||||||||||||||||||||||||||||||
| 82 | core_data => $segments->{core_data}, | ||||||||||||||||||||||||||||||||||||||||||
| 83 | disclosed_vendors_data => $segments->{disclosed_vendors}, | ||||||||||||||||||||||||||||||||||||||||||
| 84 | allowed_vendors_data => $segments->{allowed_vendors}, | ||||||||||||||||||||||||||||||||||||||||||
| 85 | publisher_tc_data => $segments->{publisher_tc}, | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 11427 | options => \%options, | |||||||||||||||||||||||||||||||||||||||||
| 87 | tc_string => $tc_string, | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | vendor_consents => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 90 | vendor_legitimate_interests => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 91 | publisher => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 92 | disclosed_vendors => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 93 | allowed_vendors => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 94 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 11427 | bless $self, $klass; | |||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 11427 | ▶ | croak "consent string is not tcf version @{[ EXPECTED_TCF_V2_VERSION ]}" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$strict and $self->version != 2
MC/DC100%2/2
$strict and $self->version != 2
$strict
$self->version != 2
Truth table100%3/3
A and B
A= $strictB= $self->version != 2
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | if $strict && $self->version != EXPECTED_TCF_V2_VERSION; | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 11425 | ▶ | croak 'invalid vendor list version' if $self->vendor_list_version == 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | # TCF v2.3: Mandatory Disclosed Vendors segment check | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 11425 | ▶ | if ($strict && $self->is_v23) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$strict and $self->is_v23
MC/DC100%2/2
$strict and $self->is_v23
$strict
$self->is_v23
Truth table100%3/3
A and B
A= $strictB= $self->is_v23
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 5 | ▶ | croak "TCF v2.3: Disclosed Vendors segment is mandatory" unless $self->has_vendor_disclosure; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 11420 | my $next_offset = $self->_parse_vendor_section(); | |||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 11417 | $self->_parse_publisher_section($next_offset); | |||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 11417 | $self->_parse_disclosed_vendors(); | |||||||||||||||||||||||||||||||||||||||||
| 113 | 11416 | $self->_parse_allowed_vendors(); | |||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 11416 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | sub tc_string { | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 20533 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 20533 | return $self->{tc_string}; | |||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | sub version { | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 2110 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 2110 | return scalar(get_uint6($self->{core_data}, OFFSETS->{VERSION})); | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | sub created { | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 2100 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
created: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 2100 | my ($seconds, $nanoseconds) = $self->_get_epoch(OFFSETS->{CREATED}); | |||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 2100 | ▶ | return wantarray ? ($seconds, $nanoseconds) : $seconds; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | sub last_updated { | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 1071 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
last_updated: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 1071 | my ($seconds, $nanoseconds) = $self->_get_epoch(OFFSETS->{LAST_UPDATED}); | |||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 1071 | ▶ | return wantarray ? ($seconds, $nanoseconds) : $seconds; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | sub _get_epoch { | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 3171 | ▶ | my ($self, $offset) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_epoch: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | # Drop the file-level `use integer` for this scope. TCF v2 stores | ||||||||||||||||||||||||||||||||||||||||||
| 150 | # Created and LastUpdated as a 36-bit deciseconds-since-epoch field, | ||||||||||||||||||||||||||||||||||||||||||
| 151 | # which exceeds a 32-bit signed IV. On a Perl built without 64-bit | ||||||||||||||||||||||||||||||||||||||||||
| 152 | # ints (e.g. the armv6l smokers), `get_uint36` returns the value as | ||||||||||||||||||||||||||||||||||||||||||
| 153 | # an NV via Math::BigInt->numify; the C-integer `/` and `%` of | ||||||||||||||||||||||||||||||||||||||||||
| 154 | # `use integer` would then coerce that NV back into an overflowing | ||||||||||||||||||||||||||||||||||||||||||
| 155 | # 32-bit IV. NV float math keeps full precision (36 bits fits in | ||||||||||||||||||||||||||||||||||||||||||
| 156 | # the 53-bit mantissa) and lands a correct integer result via int(). | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 72 | ▶ | no integer; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 3171 | my $deciseconds = scalar(get_uint36($self->{core_data}, $offset)); | |||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 3171 | my $seconds = int($deciseconds / 10); | |||||||||||||||||||||||||||||||||||||||||
| 162 | 3171 | my $nanoseconds = int(($deciseconds - $seconds * 10) * 100_000_000); | |||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | 3171 | return ($seconds, $nanoseconds); | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | sub cmp_id { | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 3127 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmp_id: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 3127 | return scalar(get_uint12($self->{core_data}, OFFSETS->{CMP_ID})); | |||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | sub cmp_version { | ||||||||||||||||||||||||||||||||||||||||||
| 174 | 1067 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmp_version: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | 1067 | return scalar(get_uint12($self->{core_data}, OFFSETS->{CMP_VERSION})); | |||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | sub consent_screen { | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 1066 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
consent_screen: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | 1066 | return scalar(get_uint6($self->{core_data}, OFFSETS->{CONSENT_SCREEN})); | |||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | sub consent_language { | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 1067 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
consent_language: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 1067 | return scalar(get_char6_pair($self->{core_data}, OFFSETS->{CONSENT_LANGUAGE})); | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | sub vendor_list_version { | ||||||||||||||||||||||||||||||||||||||||||
| 192 | 12492 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
vendor_list_version: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 12492 | return scalar(get_uint12($self->{core_data}, OFFSETS->{VENDOR_LIST_VERSION})); | |||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | sub policy_version { | ||||||||||||||||||||||||||||||||||||||||||
| 198 | 15230 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
policy_version: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 15230 | return scalar(get_uint6($self->{core_data}, OFFSETS->{POLICY_VERSION})); | |||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | sub is_v22_plus { | ||||||||||||||||||||||||||||||||||||||||||
| 204 | 3855 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_v22_plus: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | 3855 | ▶ | return $self->policy_version >= 4 ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | sub is_v23 { | ||||||||||||||||||||||||||||||||||||||||||
| 209 | 14 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_v23: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 14 | my $deadline = TCF_V23_DEADLINE; | |||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | # If a reference_time was provided and it is BEFORE the deadline, | ||||||||||||||||||||||||||||||||||||||||||
| 213 | # we skip all v2.3 checks to allow total historical simulation. | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 14 | ▶ | if (defined $self->{options}->{reference_time} && $self->{options}->{reference_time} < $deadline) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $self->{"options"}{"reference_time"} and $self->{"options"}{"reference_time"} < $deadline
MC/DC100%2/2
defined $self->{"options"}{"reference_time"} and $self->{"options"}{"reference_time"} < $deadline
defined $self->{"options"}{"reference_time"}
$self->{"options"}{"reference_time"} < $deadline
Truth table100%3/3
A and B
A= defined $self->{"options"}{"reference_time"}B= $self->{"options"}{"reference_time"} < $deadline
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 3 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | 11 | ▶ | return 1 if $self->policy_version >= 5; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | # TCF v2.3 became mandatory on 2026-02-28. Strings created on or after | ||||||||||||||||||||||||||||||||||||||||||
| 221 | # this date are subject to v2.3 rules (e.g. mandatory Disclosed Vendors). | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 5 | ▶ | return 1 if $self->created >= $deadline; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | 5 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | sub is_service_specific { | ||||||||||||||||||||||||||||||||||||||||||
| 228 | 1066 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_service_specific: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | 1066 | return scalar(is_set($self->{core_data}, OFFSETS->{SERVICE_SPECIFIC})); | |||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | sub use_non_standard_stacks { | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 1066 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
use_non_standard_stacks: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 1066 | return scalar(is_set($self->{core_data}, OFFSETS->{USE_NON_STANDARD_STACKS})); | |||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | sub is_special_feature_opt_in { | ||||||||||||||||||||||||||||||||||||||||||
| 240 | 27 | ▶ | my ($self, $id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_special_feature_opt_in: called CC=3 SCAR=13.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 27 | ▶ | croak "invalid special feature id $id: must be between 1 and @{[ MAX_SPECIAL_FEATURE_ID ]}" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$id < 1 or $id > 12
MC/DC0%0/2
$id < 1 or $id > 12
$id < 1
$id > 12
Truth table33%1/3
A or B
A= $id < 1B= $id > 12
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | if $id < 1 || $id > MAX_SPECIAL_FEATURE_ID; | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | 27 | return $self->_safe_is_special_feature_opt_in($id); | |||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | sub _safe_is_special_feature_opt_in { | ||||||||||||||||||||||||||||||||||||||||||
| 249 | 12795 | ▶ | my ($self, $id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_safe_is_special_feature_opt_in: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | 12795 | return scalar(is_set($self->{core_data}, OFFSETS->{SPECIAL_FEATURE_OPT_IN} + $id - 1)); | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | sub is_purpose_consent_allowed { | ||||||||||||||||||||||||||||||||||||||||||
| 255 | 1077 | ▶ | my ($self, @ids) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_purpose_consent_allowed: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 1077 | $self->_validate_purpose_ids('is_purpose_consent_allowed', @ids); | |||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | 1076 | foreach my $id (@ids) { | |||||||||||||||||||||||||||||||||||||||||
| 260 | 1078 | ▶ | return 0 unless $self->_safe_is_purpose_consent_allowed($id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | 1031 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | sub _safe_is_purpose_consent_allowed { | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 29819 | ▶ | my ($self, $id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_safe_is_purpose_consent_allowed: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 29819 | return scalar(is_set($self->{core_data}, OFFSETS->{PURPOSE_CONSENT_ALLOWED} + $id - 1)); | |||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | sub is_purpose_legitimate_interest_allowed { | ||||||||||||||||||||||||||||||||||||||||||
| 272 | 55 | ▶ | my ($self, @ids) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_purpose_legitimate_interest_allowed: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 55 | $self->_validate_purpose_ids('is_purpose_legitimate_interest_allowed', @ids); | |||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 54 | foreach my $id (@ids) { | |||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | # SPEC: Purpose 1 never allows Legitimate Interest | ||||||||||||||||||||||||||||||||||||||||||
| 279 | 56 | ▶ | return 0 if $id == 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | # SPEC: TCF v2.2+ (Policy >= 4) prohibits LI for Purposes 3, 4, 5, and 6 | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 52 | ▶ | if ($self->is_v22_plus) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | 2 | ▶ | return 0 if $id >= 3 && $id <= 6; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$id >= 3 and $id <= 6
MC/DC50%1/2
$id >= 3 and $id <= 6
$id >= 3
$id <= 6
Truth table66%2/3
A and B
A= $id >= 3B= $id <= 6
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | 51 | ▶ | return 0 unless $self->_safe_is_purpose_legitimate_interest_allowed($id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | 9 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | sub _validate_purpose_ids { | ||||||||||||||||||||||||||||||||||||||||||
| 293 | 1132 | ▶ | my ($self, $method_name, @ids) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_purpose_ids: called CC=5 SCAR=17.8
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 1132 | ▶ | croak "method $method_name requires at least one argument" unless @ids; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 1130 | foreach my $id (@ids) { | |||||||||||||||||||||||||||||||||||||||||
| 298 | 1134 | ▶ | croak "invalid purpose id $id: must be between 1 and @{[ MAX_PURPOSE_ID ]}" if $id < 1 || $id > MAX_PURPOSE_ID; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$id < 1 or $id > 24
MC/DC0%0/2
$id < 1 or $id > 24
$id < 1
$id > 24
Truth table33%1/3
A or B
A= $id < 1B= $id > 24
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | sub _safe_is_purpose_legitimate_interest_allowed { | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 27138 | ▶ | my ($self, $id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_safe_is_purpose_legitimate_interest_allowed: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 27138 | return scalar(is_set($self->{core_data}, OFFSETS->{PURPOSE_LIT_ALLOWED} + $id - 1)); | |||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | sub purpose_one_treatment { | ||||||||||||||||||||||||||||||||||||||||||
| 309 | 1067 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
purpose_one_treatment: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | 1067 | return scalar(is_set($self->{core_data}, OFFSETS->{PURPOSE_ONE_TREATMENT})); | |||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | sub publisher_country_code { | ||||||||||||||||||||||||||||||||||||||||||
| 315 | 1066 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
publisher_country_code: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 1066 | return scalar(get_char6_pair($self->{core_data}, OFFSETS->{PUBLISHER_COUNTRY_CODE})); | |||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | sub max_vendor_id_consent { | ||||||||||||||||||||||||||||||||||||||||||
| 321 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
max_vendor_id_consent: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | 3 | return $self->{vendor_consents}->max_id; | |||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | sub max_vendor_id_legitimate_interest { | ||||||||||||||||||||||||||||||||||||||||||
| 327 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
max_vendor_id_legitimate_interest: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 3 | return $self->{vendor_legitimate_interests}->max_id; | |||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | sub vendor_consent { | ||||||||||||||||||||||||||||||||||||||||||
| 333 | 7025 | ▶ | my ($self, $id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
vendor_consent: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | 7025 | return $self->{vendor_consents}->contains($id); | |||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | sub vendor_legitimate_interest { | ||||||||||||||||||||||||||||||||||||||||||
| 339 | 3236 | ▶ | my ($self, $id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
vendor_legitimate_interest: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 3236 | return $self->{vendor_legitimate_interests}->contains($id); | |||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | sub disclosed_vendor { | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 57 | ▶ | my ($self, $id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disclosed_vendor: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | 57 | ▶ | return 0 unless defined $self->{disclosed_vendors}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | 57 | return $self->{disclosed_vendors}->contains($id); | |||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | sub has_vendor_disclosure { | ||||||||||||||||||||||||||||||||||||||||||
| 353 | 1036 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_vendor_disclosure: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | 1036 | ▶ | return defined $self->{disclosed_vendors} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | sub allowed_vendor { | ||||||||||||||||||||||||||||||||||||||||||
| 358 | 1 | ▶ | my ($self, $id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
allowed_vendor: called CC=2 SCAR=8.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 1 | ▶ | return 0 unless defined $self->{allowed_vendors}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | return $self->{allowed_vendors}->contains($id); | |||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | sub check_publisher_restriction { | ||||||||||||||||||||||||||||||||||||||||||
| 366 | 21522 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_publisher_restriction: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | 21522 | my ($purpose_id, $restriction_type, $vendor_id); | |||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | 21522 | ▶ | if (scalar(@_) == 6) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 371 | 3 | my (%opts) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | 3 | $purpose_id = $opts{purpose_id}; | |||||||||||||||||||||||||||||||||||||||||
| 374 | 3 | $restriction_type = $opts{restriction_type}; | |||||||||||||||||||||||||||||||||||||||||
| 375 | 3 | $vendor_id = $opts{vendor_id}; | |||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||
| 377 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 378 | 21519 | ($purpose_id, $restriction_type, $vendor_id) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | 21522 | return $self->{publisher}->check_restriction($purpose_id, $restriction_type, $vendor_id); | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | sub has_publisher_restrictions { | ||||||||||||||||||||||||||||||||||||||||||
| 385 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_publisher_restrictions: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 386 | 2 | ▶ | return $self->{publisher} ? $self->{publisher}->has_restrictions : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | sub publisher_restrictions { | ||||||||||||||||||||||||||||||||||||||||||
| 390 | 8 | ▶ | my ($self, $vendor_id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
publisher_restrictions: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | 8 | return $self->{publisher}->restrictions($vendor_id); | |||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||
| 395 | sub publisher_tc { | ||||||||||||||||||||||||||||||||||||||||||
| 396 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
publisher_tc: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | 4 | return $self->{publisher}->publisher_tc; | |||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||
| 401 | sub is_vendor_consent_allowed { | ||||||||||||||||||||||||||||||||||||||||||
| 402 | 4631 | ▶ | my ($self, $vendor_id, @args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_vendor_consent_allowed: called CC=8 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | 4631 | my ($purpose_ids, $opts) = $self->_parse_vendor_args(@args); | |||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||
| 406 | 4631 | foreach my $purpose_id (@$purpose_ids) { | |||||||||||||||||||||||||||||||||||||||||
| 407 | 4632 | ▶ | return 0 unless $self->_check_purpose_id($purpose_id, %$opts); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | 4625 | ▶ | return 0 unless $self->vendor_consent($vendor_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||
| 412 | 3396 | foreach my $purpose_id (@$purpose_ids) { | |||||||||||||||||||||||||||||||||||||||||
| 413 | 3397 | ▶ | return 0 if $self->check_publisher_restriction($purpose_id, NotAllowed, $vendor_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 414 | 3397 | ▶ | return 0 if $self->check_publisher_restriction($purpose_id, RequireLegitimateInterest, $vendor_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||
| 416 | 3397 | ▶ | return 0 unless $self->_safe_is_purpose_consent_allowed($purpose_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | 3319 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||
| 422 | sub is_vendor_legitimate_interest_allowed { | ||||||||||||||||||||||||||||||||||||||||||
| 423 | 1860 | ▶ | my ($self, $vendor_id, @args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_vendor_legitimate_interest_allowed: called CC=12 SCAR=25.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 1860 | my ($purpose_ids, $opts) = $self->_parse_vendor_args(@args); | |||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | 1860 | foreach my $purpose_id (@$purpose_ids) { | |||||||||||||||||||||||||||||||||||||||||
| 428 | 1860 | ▶ | return 0 unless $self->_check_purpose_id($purpose_id, %$opts); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | 1860 | ▶ | return 0 unless $self->vendor_legitimate_interest($vendor_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||
| 433 | 1757 | foreach my $purpose_id (@$purpose_ids) { | |||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | # SPEC: Purpose 1 never allows Legitimate Interest | ||||||||||||||||||||||||||||||||||||||||||
| 436 | 1757 | ▶ | return 0 if $purpose_id == 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | # SPEC: TCF v2.2+ (Policy >= 4) prohibits LI for Purposes 3, 4, 5, and 6 | ||||||||||||||||||||||||||||||||||||||||||
| 439 | 1742 | ▶ | if ($self->is_v22_plus) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 440 | 1413 | ▶ | return 0 if $purpose_id >= 3 && $purpose_id <= 6; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$purpose_id >= 3 and $purpose_id <= 6
MC/DC0%0/2
$purpose_id >= 3 and $purpose_id <= 6
$purpose_id >= 3
$purpose_id <= 6
Truth table66%2/3
A and B
A= $purpose_id >= 3B= $purpose_id <= 6
| |||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||
| 443 | 1742 | ▶ | return 0 if $self->check_publisher_restriction($purpose_id, NotAllowed, $vendor_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 444 | 1742 | ▶ | return 0 if $self->check_publisher_restriction($purpose_id, RequireConsent, $vendor_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | 1742 | ▶ | return 0 unless $self->_safe_is_purpose_legitimate_interest_allowed($purpose_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | 1598 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | sub _parse_vendor_args { | ||||||||||||||||||||||||||||||||||||||||||
| 453 | 6491 | ▶ | my ($self, @args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_vendor_args: called CC=5 SCAR=16.8
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||
| 455 | 6491 | ▶ | if (@args && ref $args[-1] eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@args and ref $args[-1] eq "HASH"
MC/DC0%0/2
@args and ref $args[-1] eq "HASH"
@args
ref $args[-1] eq "HASH"
Truth table33%1/3
A and B
A= @argsB= ref $args[-1] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | my $opts = pop @args; | |||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | return (\@args, $opts); | |||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||
| 460 | 6491 | my @purposes; | |||||||||||||||||||||||||||||||||||||||||
| 461 | my %opts; | ||||||||||||||||||||||||||||||||||||||||||
| 462 | 6491 | ▶ | while (@args) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 463 | 11362 | ▶ | if ($args[0] =~ /^\d+$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | 6492 | push @purposes, shift @args; | |||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||
| 466 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 467 | 4870 | %opts = @args; | |||||||||||||||||||||||||||||||||||||||||
| 468 | 4870 | last; | |||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||
| 472 | 6491 | return (\@purposes, \%opts); | |||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | sub is_vendor_allowed_for_any_basis { | ||||||||||||||||||||||||||||||||||||||||||
| 476 | 195 | ▶ | my ($self, $vendor_id, @args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_vendor_allowed_for_any_basis: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||
| 478 | 195 | ▶ | return 1 if $self->is_vendor_consent_allowed($vendor_id, @args); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 479 | 188 | ▶ | return 1 if $self->is_vendor_legitimate_interest_allowed($vendor_id, @args); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||
| 481 | 100 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||
| 484 | sub is_vendor_allowed_for_flexible_purpose { | ||||||||||||||||||||||||||||||||||||||||||
| 485 | 2061 | ▶ | my ($self, $vendor_id, $purpose_id, $default_is_li, %opts) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_vendor_allowed_for_flexible_purpose: called CC=10 SCAR=23.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||
| 487 | 2061 | ▶ | return 0 unless $self->_check_purpose_id($purpose_id, %opts); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||
| 489 | # SPEC: TCF v2.2+ (Policy >= 4) prohibits LI for Purposes 3, 4, 5, and 6 | ||||||||||||||||||||||||||||||||||||||||||
| 490 | 2061 | ▶ | if ($self->is_v22_plus && $purpose_id >= 3 && $purpose_id <= 6) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$self->is_v22_plus and $purpose_id >= 3 and $purpose_id <= 6
$self->is_v22_plus and $purpose_id >= 3
MC/DC100%3/3
$self->is_v22_plus and $purpose_id >= 3 and $purpose_id <= 6
$self->is_v22_plus
$purpose_id >= 3
$purpose_id <= 6
Truth table100%4/4
A and B and C
A= $self->is_v22_plusB= $purpose_id >= 3C= $purpose_id <= 6
| |||||||||||||||||||||||||||||||||||||||||||
| 491 | 1 | $default_is_li = 0; | |||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | # SPEC: Purpose 1 never allows Legitimate Interest | ||||||||||||||||||||||||||||||||||||||||||
| 495 | 2061 | ▶ | if ($purpose_id == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | $default_is_li = 0; | |||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||
| 499 | 2061 | ▶ | if ($self->check_publisher_restriction($purpose_id, RequireConsent, $vendor_id)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 500 | 589 | return $self->is_vendor_consent_allowed($vendor_id, $purpose_id, %opts); | |||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | 1472 | ▶ | if ($self->check_publisher_restriction($purpose_id, RequireLegitimateInterest, $vendor_id)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 504 | 8 | return $self->is_vendor_legitimate_interest_allowed($vendor_id, $purpose_id, %opts); | |||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||
| 507 | 1464 | ▶ | if ($self->check_publisher_restriction($purpose_id, NotAllowed, $vendor_id)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 508 | 2 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||
| 511 | 1462 | ▶ | if ($default_is_li) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 512 | 730 | return $self->is_vendor_legitimate_interest_allowed($vendor_id, $purpose_id, %opts); | |||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | 732 | return $self->is_vendor_consent_allowed($vendor_id, $purpose_id, %opts); | |||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | sub _check_purpose_id { | ||||||||||||||||||||||||||||||||||||||||||
| 519 | 8553 | ▶ | my ($self, $id, %opts) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_purpose_id: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||
| 521 | 8553 | ▶ | my $strict = exists $opts{strict} ? $opts{strict} : $self->{options}->{strict}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||
| 523 | 8553 | ▶ | if ($id < 1 || $id > MAX_PURPOSE_ID) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$id < 1 or $id > 24
MC/DC100%2/2
$id < 1 or $id > 24
$id < 1
$id > 24
Truth table100%3/3
A or B
A= $id < 1B= $id > 24
| |||||||||||||||||||||||||||||||||||||||||||
| 524 | 6 | ▶ | if ($strict) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 525 | 3 | croak "invalid purpose id $id: must be between 1 and @{[ MAX_PURPOSE_ID ]}"; | |||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||
| 527 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 528 | 3 | carp "invalid purpose id $id: must be between 1 and @{[ MAX_PURPOSE_ID ]}"; | |||||||||||||||||||||||||||||||||||||||||
| 529 | 3 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | 8547 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||
| 536 | sub _format_date { | ||||||||||||||||||||||||||||||||||||||||||
| 537 | 2128 | ▶ | my ($self, $epoch, $nanoseconds) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_format_date: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||
| 539 | 2128 | ▶ | return $epoch if !!$self->{options}->{json}->{use_epoch}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||
| 541 | 2124 | my $format = $self->{options}->{json}->{date_format}; | |||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||
| 543 | 2124 | ▶ | return $format->($epoch, $nanoseconds) if ref($format) eq ref(sub { }); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||
| 545 | 2124 | return strftime($format, gmtime($epoch)); | |||||||||||||||||||||||||||||||||||||||||
| 546 | } | ||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||
| 548 | sub _json_true { 1 == 1 } | ||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||
| 550 | sub _json_false { 1 == 0 } | ||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||
| 552 | sub _format_json_subsection { | ||||||||||||||||||||||||||||||||||||||||||
| 553 | 3192 | ▶ | my ($self, @data) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_format_json_subsection: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||
| 555 | 3192 | ▶ | if (!!$self->{options}->{json}->{compact}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 556 | 57 | return [map { $_->[0] } grep { $_->[1] } @data]; | |||||||||||||||||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||
| 559 | 3135 | my $verbose = !!$self->{options}->{json}->{verbose}; | |||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||
| 561 | 3135 | ▶ | return {map { @{$_} } grep { $verbose || $_->[1] } @data}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||
| 564 | sub TO_JSON { | ||||||||||||||||||||||||||||||||||||||||||
| 565 | 1064 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TO_JSON: called CC=14 SCAR=26.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||
| 567 | 1064 | ▶ | my %args = (@_ && ref $_[-1] eq 'HASH') ? %{pop @_} : @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@_ and ref $_[-1] eq "HASH"
MC/DC0%0/2
@_ and ref $_[-1] eq "HASH"
@_
ref $_[-1] eq "HASH"
Truth table66%2/3
A and B
A= @_B= ref $_[-1] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 568 | 1064 | ▶ | my $filter_id = $args{vendor_id} // $self->{options}->{json}->{vendor_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$args{"vendor_id"} // $self->{"options"}{"json"}{"vendor_id"}
MC/DC100%2/2
$args{"vendor_id"} // $self->{"options"}{"json"}{"vendor_id"}
$args{"vendor_id"}
$self->{"options"}{"json"}{"vendor_id"}
Truth table100%3/3
A // B
A= $args{"vendor_id"}B= $self->{"options"}{"json"}{"vendor_id"}
| |||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||
| 570 | 1064 | my ($false, $true) = @{$self->{options}->{json}->{boolean_values}}; | |||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||
| 572 | 1064 | my $created = $self->_format_date($self->created); | |||||||||||||||||||||||||||||||||||||||||
| 573 | 1064 | my $last_updated = $self->_format_date($self->last_updated); | |||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||
| 575 | my $purpose_consents = $self->_format_json_subsection( | ||||||||||||||||||||||||||||||||||||||||||
| 576 | 1064 | map { [ | |||||||||||||||||||||||||||||||||||||||||
| 577 | 25536 | ▶ | $_ => ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 578 | $filter_id | ||||||||||||||||||||||||||||||||||||||||||
| 579 | ? $self->is_vendor_allowed_for_any_basis($filter_id, $_) | ||||||||||||||||||||||||||||||||||||||||||
| 580 | : $self->_safe_is_purpose_consent_allowed($_) | ||||||||||||||||||||||||||||||||||||||||||
| 581 | ) ? $true : $false | ||||||||||||||||||||||||||||||||||||||||||
| 582 | ] } 1 .. MAX_PURPOSE_ID, | ||||||||||||||||||||||||||||||||||||||||||
| 583 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||
| 585 | my $purpose_li = $self->_format_json_subsection( | ||||||||||||||||||||||||||||||||||||||||||
| 586 | 1064 | map { [ | |||||||||||||||||||||||||||||||||||||||||
| 587 | 25536 | ▶ | $_ => ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 588 | $filter_id | ||||||||||||||||||||||||||||||||||||||||||
| 589 | ? $self->is_vendor_legitimate_interest_allowed($filter_id, $_) | ||||||||||||||||||||||||||||||||||||||||||
| 590 | : $self->_safe_is_purpose_legitimate_interest_allowed($_) | ||||||||||||||||||||||||||||||||||||||||||
| 591 | ) ? $true : $false | ||||||||||||||||||||||||||||||||||||||||||
| 592 | ] } 1 .. MAX_PURPOSE_ID, | ||||||||||||||||||||||||||||||||||||||||||
| 593 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||
| 595 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 596 | tc_string => $self->tc_string, | ||||||||||||||||||||||||||||||||||||||||||
| 597 | version => $self->version, | ||||||||||||||||||||||||||||||||||||||||||
| 598 | created => $created, | ||||||||||||||||||||||||||||||||||||||||||
| 599 | last_updated => $last_updated, | ||||||||||||||||||||||||||||||||||||||||||
| 600 | cmp_id => $self->cmp_id, | ||||||||||||||||||||||||||||||||||||||||||
| 601 | cmp_version => $self->cmp_version, | ||||||||||||||||||||||||||||||||||||||||||
| 602 | consent_screen => $self->consent_screen, | ||||||||||||||||||||||||||||||||||||||||||
| 603 | consent_language => $self->consent_language, | ||||||||||||||||||||||||||||||||||||||||||
| 604 | vendor_list_version => $self->vendor_list_version, | ||||||||||||||||||||||||||||||||||||||||||
| 605 | policy_version => $self->policy_version, | ||||||||||||||||||||||||||||||||||||||||||
| 606 | is_service_specific => $self->is_service_specific ? $true : $false, | ||||||||||||||||||||||||||||||||||||||||||
| 607 | use_non_standard_stacks => $self->use_non_standard_stacks ? $true : $false, | ||||||||||||||||||||||||||||||||||||||||||
| 608 | purpose_one_treatment => $self->purpose_one_treatment ? $true : $false, | ||||||||||||||||||||||||||||||||||||||||||
| 609 | publisher_country_code => $self->publisher_country_code, | ||||||||||||||||||||||||||||||||||||||||||
| 610 | special_features_opt_in => $self->_format_json_subsection( | ||||||||||||||||||||||||||||||||||||||||||
| 611 | 12768 | ▶ | map { [$_ => $self->_safe_is_special_feature_opt_in($_) ? $true : $false] } 1 .. MAX_SPECIAL_FEATURE_ID | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 612 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 613 | purpose => {consents => $purpose_consents, legitimate_interests => $purpose_li,}, | ||||||||||||||||||||||||||||||||||||||||||
| 614 | vendor => { | ||||||||||||||||||||||||||||||||||||||||||
| 615 | consents => $self->{vendor_consents}->TO_JSON($filter_id), | ||||||||||||||||||||||||||||||||||||||||||
| 616 | legitimate_interests => $self->{vendor_legitimate_interests}->TO_JSON($filter_id), | ||||||||||||||||||||||||||||||||||||||||||
| 617 | ($self->{disclosed_vendors} ? (disclosed => $self->{disclosed_vendors}->TO_JSON($filter_id)) : ()), | ||||||||||||||||||||||||||||||||||||||||||
| 618 | ($self->{allowed_vendors} ? (allowed => $self->{allowed_vendors}->TO_JSON($filter_id)) : ()), | ||||||||||||||||||||||||||||||||||||||||||
| 619 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 620 | 1064 | ▶ | publisher => $self->{publisher}->TO_JSON($filter_id), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 621 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||
| 624 | sub _decode_tc_string_segments { | ||||||||||||||||||||||||||||||||||||||||||
| 625 | 11438 | ▶ | my $tc_string = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_decode_tc_string_segments: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||
| 627 | 11438 | my ($core, @parts) = split CONSENT_STRING_TCF_V2->{SEPARATOR}, $tc_string; | |||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||
| 629 | 11438 | my $core_data = _validate_and_decode_base64($core); | |||||||||||||||||||||||||||||||||||||||||
| 630 | 11431 | my $core_data_size = length($core_data); | |||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||
| 632 | croak | ||||||||||||||||||||||||||||||||||||||||||
| 633 | 3 | "vendor consent strings are at least @{[ CONSENT_STRING_TCF_V2->{MIN_BYTE_SIZE} ]} bytes long (got ${core_data_size} bytes)" | |||||||||||||||||||||||||||||||||||||||||
| 634 | 11431 | ▶ | if $core_data_size < CONSENT_STRING_TCF_V2->{MIN_BYTE_SIZE}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||
| 636 | 11428 | my %segments; | |||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||
| 638 | 11428 | foreach my $part (@parts) { | |||||||||||||||||||||||||||||||||||||||||
| 639 | 10276 | my $decoded = _validate_and_decode_base64($part); | |||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||
| 641 | 10276 | my $segment_type = get_uint3($decoded, OFFSETS->{SEGMENT_TYPE}); | |||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||
| 643 | 10276 | ▶ | croak "duplicate segment type $segment_type" if exists $segments{$segment_type}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||
| 645 | 10275 | $segments{$segment_type} = $decoded; | |||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||
| 648 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 649 | core_data => $core_data, | ||||||||||||||||||||||||||||||||||||||||||
| 650 | disclosed_vendors => $segments{SEGMENT_TYPES->{DISCLOSED_VENDORS}}, | ||||||||||||||||||||||||||||||||||||||||||
| 651 | allowed_vendors => $segments{SEGMENT_TYPES->{ALLOWED_VENDORS}}, | ||||||||||||||||||||||||||||||||||||||||||
| 652 | publisher_tc => $segments{SEGMENT_TYPES->{PUBLISHER_TC}}, | ||||||||||||||||||||||||||||||||||||||||||
| 653 | 11427 | }; | |||||||||||||||||||||||||||||||||||||||||
| 654 | } | ||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||
| 656 | sub _validate_and_decode_base64 { | ||||||||||||||||||||||||||||||||||||||||||
| 657 | 21714 | ▶ | my $s = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_and_decode_base64: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||
| 659 | # see: https://www.perlmonks.org/?node_id=775820 | ||||||||||||||||||||||||||||||||||||||||||
| 660 | 21714 | ▶ | croak "invalid base64 format" unless $s =~ m{ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 661 | ^ | ||||||||||||||||||||||||||||||||||||||||||
| 662 | (?:[-A-Za-z0-9_]{4})* | ||||||||||||||||||||||||||||||||||||||||||
| 663 | (?: | ||||||||||||||||||||||||||||||||||||||||||
| 664 | [-A-Za-z0-9_]{2}[AEIMQUYcgkosw048] | ||||||||||||||||||||||||||||||||||||||||||
| 665 | | | ||||||||||||||||||||||||||||||||||||||||||
| 666 | [-A-Za-z0-9_][AQgw] | ||||||||||||||||||||||||||||||||||||||||||
| 667 | )? | ||||||||||||||||||||||||||||||||||||||||||
| 668 | \z | ||||||||||||||||||||||||||||||||||||||||||
| 669 | }x; | ||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||
| 671 | 21707 | return _decode_base64url($s); | |||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||
| 674 | sub _decode_base64url { | ||||||||||||||||||||||||||||||||||||||||||
| 675 | my $s = shift; | ||||||||||||||||||||||||||||||||||||||||||
| 676 | $s =~ tr/-_/+\//; | ||||||||||||||||||||||||||||||||||||||||||
| 677 | $s .= '=' while length($s) % 4; | ||||||||||||||||||||||||||||||||||||||||||
| 678 | return decode_base64($s); | ||||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | sub _parse_vendor_section { | ||||||||||||||||||||||||||||||||||||||||||
| 682 | 11420 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_vendor_section: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||
| 684 | # parse vendor consent | ||||||||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||||||||
| 686 | 11420 | my $legitimate_interest_offset = $self->_parse_vendor_consents(OFFSETS->{VENDOR_CONSENT}); | |||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||
| 688 | # parse vendor legitimate interest | ||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||
| 690 | 11420 | my $pub_restriction_offset = $self->_parse_vendor_legitimate_interests($legitimate_interest_offset); | |||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||
| 692 | 11417 | return $pub_restriction_offset; | |||||||||||||||||||||||||||||||||||||||||
| 693 | } | ||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | sub _parse_vendor_consents { | ||||||||||||||||||||||||||||||||||||||||||
| 696 | 11420 | ▶ | my ($self, $vendor_consent_offset) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_vendor_consents: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||
| 698 | 11420 | my ($vendor_consents, $legitimate_interest_offset) = $self->_parse_bitfield_or_range($vendor_consent_offset,); | |||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||
| 700 | 11420 | $self->{vendor_consents} = $vendor_consents; | |||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||
| 702 | 11420 | return $legitimate_interest_offset; | |||||||||||||||||||||||||||||||||||||||||
| 703 | } | ||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||
| 705 | sub _parse_vendor_legitimate_interests { | ||||||||||||||||||||||||||||||||||||||||||
| 706 | 11420 | ▶ | my ($self, $legitimate_interest_offset) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_vendor_legitimate_interests: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||
| 708 | 11420 | my $data_size_bits = length($self->{core_data}) << 3; | |||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||
| 710 | my ($vendor_legitimate_interests, $pub_restriction_offset) = $self->_parse_bitfield_or_range( | ||||||||||||||||||||||||||||||||||||||||||
| 711 | $legitimate_interest_offset, | ||||||||||||||||||||||||||||||||||||||||||
| 712 | sub { | ||||||||||||||||||||||||||||||||||||||||||
| 713 | 11420 | ▶ | my $legitimate_interest_start = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||
| 715 | 11420 | ▶ | croak "invalid consent data: no legitimate interest start position" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 716 | if $legitimate_interest_start >= $data_size_bits; | ||||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||
| 718 | 11420 | ); | |||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||
| 720 | 11417 | $self->{vendor_legitimate_interests} = $vendor_legitimate_interests; | |||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||
| 722 | 11417 | return $pub_restriction_offset; | |||||||||||||||||||||||||||||||||||||||||
| 723 | } | ||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||
| 725 | sub _parse_publisher_section { | ||||||||||||||||||||||||||||||||||||||||||
| 726 | 11417 | ▶ | my ($self, $pub_restriction_offset) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_publisher_section: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||
| 728 | # parse public restrictions | ||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||
| 730 | my $publisher = GDPR::IAB::TCFv2::Publisher->Parse( | ||||||||||||||||||||||||||||||||||||||||||
| 731 | core_data => $self->{core_data}, | ||||||||||||||||||||||||||||||||||||||||||
| 732 | core_data_size => length($self->{core_data}), | ||||||||||||||||||||||||||||||||||||||||||
| 733 | offset => $pub_restriction_offset, | ||||||||||||||||||||||||||||||||||||||||||
| 734 | publisher_tc_data => $self->{publisher_tc_data}, | ||||||||||||||||||||||||||||||||||||||||||
| 735 | options => $self->{options}, | ||||||||||||||||||||||||||||||||||||||||||
| 736 | 11417 | ); | |||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||
| 738 | 11417 | $self->{publisher} = $publisher; | |||||||||||||||||||||||||||||||||||||||||
| 739 | } | ||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||
| 741 | sub _parse_disclosed_vendors { | ||||||||||||||||||||||||||||||||||||||||||
| 742 | 11417 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_disclosed_vendors: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||
| 744 | 11417 | ▶ | return unless defined $self->{disclosed_vendors_data}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||
| 746 | $self->{disclosed_vendors} | ||||||||||||||||||||||||||||||||||||||||||
| 747 | 592 | = $self->_parse_vendor_bitfield_or_range($self->{disclosed_vendors_data}, SEGMENT_TYPES->{DISCLOSED_VENDORS},); | |||||||||||||||||||||||||||||||||||||||||
| 748 | } | ||||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||
| 750 | sub _parse_allowed_vendors { | ||||||||||||||||||||||||||||||||||||||||||
| 751 | 11416 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_allowed_vendors: called CC=2 SCAR=8.1
| |||||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||
| 753 | 11416 | ▶ | return unless defined $self->{allowed_vendors_data}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||
| 755 | $self->{allowed_vendors} | ||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | = $self->_parse_vendor_bitfield_or_range($self->{allowed_vendors_data}, SEGMENT_TYPES->{ALLOWED_VENDORS},); | |||||||||||||||||||||||||||||||||||||||||
| 757 | } | ||||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||
| 759 | # Returns only $vendors_section -- unlike _parse_bitfield_or_range, which | ||||||||||||||||||||||||||||||||||||||||||
| 760 | # yields ($section, $next_offset) so the caller can keep parsing the core | ||||||||||||||||||||||||||||||||||||||||||
| 761 | # segment. Disclosed/Allowed Vendors live in their own base64 segment | ||||||||||||||||||||||||||||||||||||||||||
| 762 | # with nothing trailing the bitfield/range, so there is no offset to chain. | ||||||||||||||||||||||||||||||||||||||||||
| 763 | sub _parse_vendor_bitfield_or_range { | ||||||||||||||||||||||||||||||||||||||||||
| 764 | 594 | ▶ | my ($self, $data, $expected_segment_type) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_vendor_bitfield_or_range: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||
| 766 | # If data looks like a string of 0/1 (from legacy tests), pack it. | ||||||||||||||||||||||||||||||||||||||||||
| 767 | 594 | ▶ | if ($data =~ /^[01]+$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 768 | 2 | $data = pack("B*", $data); | |||||||||||||||||||||||||||||||||||||||||
| 769 | } | ||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||
| 771 | 594 | my ($segment_type, $offset) = get_uint3($data, 0); | |||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||
| 773 | 594 | ▶ | croak "invalid segment type $segment_type: expected $expected_segment_type" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $expected_segment_type and $segment_type != $expected_segment_type
MC/DC50%1/2
defined $expected_segment_type and $segment_type != $expected_segment_type
defined $expected_segment_type
$segment_type != $expected_segment_type
Truth table66%2/3
A and B
A= defined $expected_segment_typeB= $segment_type != $expected_segment_type
| |||||||||||||||||||||||||||||||||||||||||||
| 774 | if defined $expected_segment_type && $segment_type != $expected_segment_type; | ||||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||
| 776 | 593 | my ($max_id, $next_offset) = get_uint16($data, $offset); | |||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||
| 778 | # Spec: MaxVendorId == 0 means "field unused". Skip the IsRange flag | ||||||||||||||||||||||||||||||||||||||||||
| 779 | # and any trailing payload entirely; return an empty BitField so that | ||||||||||||||||||||||||||||||||||||||||||
| 780 | # has_vendor_disclosure() still reports the segment as present while | ||||||||||||||||||||||||||||||||||||||||||
| 781 | # contains() always returns false for any vendor id. | ||||||||||||||||||||||||||||||||||||||||||
| 782 | 593 | ▶ | if ($max_id == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 783 | my ($empty_section) = GDPR::IAB::TCFv2::BitField->Parse( | ||||||||||||||||||||||||||||||||||||||||||
| 784 | data => $data, | ||||||||||||||||||||||||||||||||||||||||||
| 785 | data_size => length($data), | ||||||||||||||||||||||||||||||||||||||||||
| 786 | max_id => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 787 | offset => $next_offset, | ||||||||||||||||||||||||||||||||||||||||||
| 788 | options => $self->{options}, | ||||||||||||||||||||||||||||||||||||||||||
| 789 | 2 | ); | |||||||||||||||||||||||||||||||||||||||||
| 790 | 2 | return $empty_section; | |||||||||||||||||||||||||||||||||||||||||
| 791 | } | ||||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||
| 793 | 591 | my ($is_range, $bf_offset) = is_set($data, $next_offset); | |||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||
| 795 | 591 | my $vendors_section; | |||||||||||||||||||||||||||||||||||||||||
| 796 | 591 | ▶ | if ($is_range) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 797 | ($vendors_section,) = GDPR::IAB::TCFv2::RangeSection->Parse( | ||||||||||||||||||||||||||||||||||||||||||
| 798 | data => $data, | ||||||||||||||||||||||||||||||||||||||||||
| 799 | data_size => length($data), | ||||||||||||||||||||||||||||||||||||||||||
| 800 | offset => $bf_offset, | ||||||||||||||||||||||||||||||||||||||||||
| 801 | max_id => $max_id, | ||||||||||||||||||||||||||||||||||||||||||
| 802 | options => $self->{options}, | ||||||||||||||||||||||||||||||||||||||||||
| 803 | 11 | ); | |||||||||||||||||||||||||||||||||||||||||
| 804 | } | ||||||||||||||||||||||||||||||||||||||||||
| 805 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 806 | ($vendors_section,) = GDPR::IAB::TCFv2::BitField->Parse( | ||||||||||||||||||||||||||||||||||||||||||
| 807 | data => $data, | ||||||||||||||||||||||||||||||||||||||||||
| 808 | data_size => length($data), | ||||||||||||||||||||||||||||||||||||||||||
| 809 | offset => $bf_offset, | ||||||||||||||||||||||||||||||||||||||||||
| 810 | max_id => $max_id, | ||||||||||||||||||||||||||||||||||||||||||
| 811 | options => $self->{options}, | ||||||||||||||||||||||||||||||||||||||||||
| 812 | 580 | ); | |||||||||||||||||||||||||||||||||||||||||
| 813 | } | ||||||||||||||||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||||||||||||||||
| 815 | 590 | return $vendors_section; | |||||||||||||||||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||
| 818 | sub _parse_bitfield_or_range { | ||||||||||||||||||||||||||||||||||||||||||
| 819 | 22840 | ▶ | my ($self, $offset, $validate_next_offset) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_bitfield_or_range: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||
| 821 | 22840 | my $vendors_section; | |||||||||||||||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||||||||||||||||
| 823 | 22840 | my ($max_id, $next_offset) = get_uint16($self->{core_data}, $offset); | |||||||||||||||||||||||||||||||||||||||||
| 824 | |||||||||||||||||||||||||||||||||||||||||||
| 825 | 22840 | ▶ | $validate_next_offset->($next_offset) if defined $validate_next_offset; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||||||||||||||||
| 827 | 22838 | my $is_range; | |||||||||||||||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||||||||||||||||
| 829 | 22838 | ($is_range, $next_offset) = is_set($self->{core_data}, $next_offset,); | |||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||
| 831 | 22838 | ▶ | if ($is_range) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 832 | 2470 | ($vendors_section, $next_offset) = $self->_parse_range_section($max_id, $next_offset,); | |||||||||||||||||||||||||||||||||||||||||
| 833 | } | ||||||||||||||||||||||||||||||||||||||||||
| 834 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 835 | 20368 | ($vendors_section, $next_offset) = $self->_parse_bitfield($max_id, $next_offset,); | |||||||||||||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||
| 838 | 22837 | ▶ | return wantarray ? ($vendors_section, $next_offset) : $vendors_section; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 839 | } | ||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||
| 841 | sub _parse_range_section { | ||||||||||||||||||||||||||||||||||||||||||
| 842 | 2470 | ▶ | my ($self, $max_id, $range_section_start_offset) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_range_section: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||
| 844 | my ($range_section, $next_offset) = GDPR::IAB::TCFv2::RangeSection->Parse( | ||||||||||||||||||||||||||||||||||||||||||
| 845 | data => $self->{core_data}, | ||||||||||||||||||||||||||||||||||||||||||
| 846 | data_size => length($self->{core_data}), | ||||||||||||||||||||||||||||||||||||||||||
| 847 | offset => $range_section_start_offset, | ||||||||||||||||||||||||||||||||||||||||||
| 848 | max_id => $max_id, | ||||||||||||||||||||||||||||||||||||||||||
| 849 | options => $self->{options}, | ||||||||||||||||||||||||||||||||||||||||||
| 850 | 2470 | ); | |||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||
| 852 | 2470 | ▶ | return wantarray ? ($range_section, $next_offset) : $range_section; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 853 | } | ||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||
| 855 | sub _parse_bitfield { | ||||||||||||||||||||||||||||||||||||||||||
| 856 | 20368 | ▶ | my ($self, $max_id, $bitfield_start_offset) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_bitfield: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||
| 858 | my ($bitfield, $next_offset) = GDPR::IAB::TCFv2::BitField->Parse( | ||||||||||||||||||||||||||||||||||||||||||
| 859 | data => $self->{core_data}, | ||||||||||||||||||||||||||||||||||||||||||
| 860 | data_size => length($self->{core_data}), | ||||||||||||||||||||||||||||||||||||||||||
| 861 | offset => $bitfield_start_offset, | ||||||||||||||||||||||||||||||||||||||||||
| 862 | max_id => $max_id, | ||||||||||||||||||||||||||||||||||||||||||
| 863 | options => $self->{options}, | ||||||||||||||||||||||||||||||||||||||||||
| 864 | 20368 | ); | |||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||
| 866 | 20367 | ▶ | return wantarray ? ($bitfield, $next_offset) : $bitfield; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 867 | } | ||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||
| 869 | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||
| 870 | 72 | ▶ | if (my $native_decode_base64url = MIME::Base64->can("decode_base64url")) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=4 SCAR=14.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 871 | 72 | ▶ | no warnings q<redefine>; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||
| 873 | 72 | *_decode_base64url = $native_decode_base64url; | |||||||||||||||||||||||||||||||||||||||||
| 874 | } | ||||||||||||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||||||||||||
| 876 | 72 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 877 | 72 | require JSON; | |||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||
| 879 | 72 | ▶ | if (my $native_json_true = JSON->can("true")) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 880 | 72 | ▶ | no warnings q<redefine>; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||
| 882 | 72 | *_json_true = $native_json_true; | |||||||||||||||||||||||||||||||||||||||||
| 883 | } | ||||||||||||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||||||||||||
| 885 | 72 | ▶ | if (my $native_json_false = JSON->can("false")) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 886 | 72 | ▶ | no warnings q<redefine>; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||
| 888 | 72 | *_json_false = $native_json_false; | |||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||
| 890 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 891 | } | ||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||||||||||
| 894 | 72 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 895 | __END__ | ||||||||||||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||||||||||||
| 897 | =pod | ||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||
| 899 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||
| 901 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||||||||||||||||
| 903 | GDPR::IAB::TCFv2::Parser - bit-stream parser for TCF v2.3 consent strings | ||||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||
| 905 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||
| 907 | The purpose of this package is to parse Transparency & Consent String (TC String) as defined by IAB version 2. | ||||||||||||||||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||||||||||||||||
| 909 | use warnings; | ||||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||
| 911 | use GDPR::IAB::TCFv2::Parser; | ||||||||||||||||||||||||||||||||||||||||||
| 912 | use GDPR::IAB::TCFv2::Constants::Purpose qw<:all>; | ||||||||||||||||||||||||||||||||||||||||||
| 913 | use GDPR::IAB::TCFv2::Constants::SpecialFeature qw<:all>; | ||||||||||||||||||||||||||||||||||||||||||
| 914 | use GDPR::IAB::TCFv2::Constants::RestrictionType qw<:all>; | ||||||||||||||||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||||||||||||||||
| 916 | my $consent = GDPR::IAB::TCFv2::Parser->Parse( | ||||||||||||||||||||||||||||||||||||||||||
| 917 | 'CLcVDxRMWfGmWAVAHCENAXCkAKDAADnAABRgA5mdfCKZuYJez-NQm0TBMYA4oCAAGQYIAAAAAAEAIAEgAA.argAC0gAAAAAAAAAAAA' | ||||||||||||||||||||||||||||||||||||||||||
| 918 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||
| 920 | use feature qw<say>; | ||||||||||||||||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||||||||||||||||
| 922 | say $consent->version; # 2 | ||||||||||||||||||||||||||||||||||||||||||
| 923 | say $consent->created; # epoch 1228644257 or 07/12/2008 | ||||||||||||||||||||||||||||||||||||||||||
| 924 | say $consent->last_updated; # epoch 1326215413 or 10/01/2012 | ||||||||||||||||||||||||||||||||||||||||||
| 925 | say $consent->cmp_id; # 21 - Traffective GmbH | ||||||||||||||||||||||||||||||||||||||||||
| 926 | say $consent->cmp_version; # 7 | ||||||||||||||||||||||||||||||||||||||||||
| 927 | say $consent->consent_screen; # 2 | ||||||||||||||||||||||||||||||||||||||||||
| 928 | say $consent->consent_language; # "EN" | ||||||||||||||||||||||||||||||||||||||||||
| 929 | say $consent->vendor_list_version; # 23 | ||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||
| 931 | say "find consent for purpose ids 1, 3, 9 and 10" if 4 == grep { | ||||||||||||||||||||||||||||||||||||||||||
| 932 | $consent->is_purpose_consent_allowed($_) | ||||||||||||||||||||||||||||||||||||||||||
| 933 | } ( # constants exported by GDPR::IAB::TCFv2::Constants::Purpose | ||||||||||||||||||||||||||||||||||||||||||
| 934 | InfoStorageAccess, # 1 | ||||||||||||||||||||||||||||||||||||||||||
| 935 | PersonalizationProfile, # 3 | ||||||||||||||||||||||||||||||||||||||||||
| 936 | MarketResearch, # 9 | ||||||||||||||||||||||||||||||||||||||||||
| 937 | DevelopImprove, # 10 | ||||||||||||||||||||||||||||||||||||||||||
| 938 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||||||||||||||||
| 940 | say "find consent for vendor id 284 (Weborama)" if $consent->vendor_consent(284); | ||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||
| 942 | # Geolocation exported by GDPR::IAB::TCFv2::Constants::SpecialFeature | ||||||||||||||||||||||||||||||||||||||||||
| 943 | say "user is opt in for special feature 'Geolocation (id 1)'" | ||||||||||||||||||||||||||||||||||||||||||
| 944 | if $consent->is_special_feature_opt_in(Geolocation); | ||||||||||||||||||||||||||||||||||||||||||
| 945 | |||||||||||||||||||||||||||||||||||||||||||
| 946 | # NotAllowed exported by GDPR::IAB::TCFv2::Constants::RestrictionType | ||||||||||||||||||||||||||||||||||||||||||
| 947 | say "publisher restriction for purpose Info Storage Access (1), restriction type NotAllowed (0) for weborama (284)" | ||||||||||||||||||||||||||||||||||||||||||
| 948 | if $consent->check_publisher_restriction(InfoStorageAccess, NotAllowed, 284); | ||||||||||||||||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||||||||||||||||
| 950 | For policy-driven checks against an entire vendor profile (required purposes, | ||||||||||||||||||||||||||||||||||||||||||
| 951 | legal basis, GVL flexibility, optional Disclosed Vendors enforcement), | ||||||||||||||||||||||||||||||||||||||||||
| 952 | use the L<GDPR::IAB::TCFv2::Validator> companion class instead of stringing | ||||||||||||||||||||||||||||||||||||||||||
| 953 | the predicates above together by hand: | ||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||
| 955 | use GDPR::IAB::TCFv2::Validator; | ||||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||
| 957 | my $validator = GDPR::IAB::TCFv2::Validator->new( | ||||||||||||||||||||||||||||||||||||||||||
| 958 | vendor_id => 284, | ||||||||||||||||||||||||||||||||||||||||||
| 959 | consent_purpose_ids => [ 1, 3 ], | ||||||||||||||||||||||||||||||||||||||||||
| 960 | legitimate_interest_purpose_ids => [ 7 ], | ||||||||||||||||||||||||||||||||||||||||||
| 961 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 962 | |||||||||||||||||||||||||||||||||||||||||||
| 963 | my $tc_string = '...'; | ||||||||||||||||||||||||||||||||||||||||||
| 964 | my $result = $validator->validate($tc_string); # fail-fast | ||||||||||||||||||||||||||||||||||||||||||
| 965 | # ...or $validator->validate_all($tc_string) to accumulate every reason | ||||||||||||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||||||||||||
| 967 | if ($result) { | ||||||||||||||||||||||||||||||||||||||||||
| 968 | # vendor 284 has every required permission | ||||||||||||||||||||||||||||||||||||||||||
| 969 | } | ||||||||||||||||||||||||||||||||||||||||||
| 970 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 971 | warn "compliance failed: $result\n"; # stringifies to the reasons | ||||||||||||||||||||||||||||||||||||||||||
| 972 | warn $_ for $result->reasons; | ||||||||||||||||||||||||||||||||||||||||||
| 973 | } | ||||||||||||||||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||||||||||||||||
| 975 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||||||||||||
| 977 | C<GDPR::IAB::TCFv2::Parser> is the single-pass bit-stream decoder for | ||||||||||||||||||||||||||||||||||||||||||
| 978 | TCF v2.3 (and v2.0/v2.2) consent strings, as specified by the IAB. It | ||||||||||||||||||||||||||||||||||||||||||
| 979 | is normally constructed via the L<GDPR::IAB::TCFv2> hub | ||||||||||||||||||||||||||||||||||||||||||
| 980 | (C<< GDPR::IAB::TCFv2->Parse(...) >>) but can be called directly when | ||||||||||||||||||||||||||||||||||||||||||
| 981 | you want to bypass the hub's facade. | ||||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||
| 983 | The returned object exposes every accessor, predicate, and JSON | ||||||||||||||||||||||||||||||||||||||||||
| 984 | serializer documented below. | ||||||||||||||||||||||||||||||||||||||||||
| 985 | |||||||||||||||||||||||||||||||||||||||||||
| 986 | =head1 CONSTRUCTOR | ||||||||||||||||||||||||||||||||||||||||||
| 987 | |||||||||||||||||||||||||||||||||||||||||||
| 988 | =head2 Parse | ||||||||||||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||||||||||||
| 990 | The Parse method will decode and validate a base64 encoded version of the tcf v2 string. | ||||||||||||||||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||||||||||||||||
| 992 | Will return a C<GDPR::IAB::TCFv2::Parser> immutable object that allow easy access to different properties. | ||||||||||||||||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||||||||||||||||
| 994 | Will die if can't decode the string. | ||||||||||||||||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||||||||||||||||
| 996 | use GDPR::IAB::TCFv2::Parser; | ||||||||||||||||||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||||||||||||||||
| 998 | my $consent = GDPR::IAB::TCFv2::Parser->Parse( | ||||||||||||||||||||||||||||||||||||||||||
| 999 | 'CLcVDxRMWfGmWAVAHCENAXCkAKDAADnAABRgA5mdfCKZuYJez-NQm0TBMYA4oCAAGQYIAAAAAAEAIAEgAA.argAC0gAAAAAAAAAAAA' | ||||||||||||||||||||||||||||||||||||||||||
| 1000 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||||||||||||||||
| 1002 | or | ||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||
| 1004 | use GDPR::IAB::TCFv2::Parser; | ||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||
| 1006 | my $consent = GDPR::IAB::TCFv2::Parser->Parse( | ||||||||||||||||||||||||||||||||||||||||||
| 1007 | 'CLcVDxRMWfGmWAVAHCENAXCkAKDAADnAABRgA5mdfCKZuYJez-NQm0TBMYA4oCAAGQYIAAAAAAEAIAEgAA.argAC0gAAAAAAAAAAAA', | ||||||||||||||||||||||||||||||||||||||||||
| 1008 | json => { | ||||||||||||||||||||||||||||||||||||||||||
| 1009 | verbose => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 1010 | compact => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 1011 | use_epoch => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 1012 | boolean_values => [ 0, 1 ], | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | date_format => '%Y%m%d', # yyymmdd | ||||||||||||||||||||||||||||||||||||||||||
| 1014 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 1015 | strict => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 1016 | prefetch => 284, | ||||||||||||||||||||||||||||||||||||||||||
| 1017 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||
| 1019 | Parse may receive an optional hash with the following parameters: | ||||||||||||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||||||||||||
| 1021 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||||||||||||||||
| 1023 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||||||||||||||||
| 1025 | On C<strict> mode we will validate if the version of the consent string is the version 2 (or die with an exception). | ||||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||
| 1027 | Additionally, for TCF v2.3 strings (Policy Version 5+), C<strict> mode will enforce that the B<Disclosed Vendors> segment is present. | ||||||||||||||||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||||||||||||||||
| 1029 | The C<strict> mode is disabled by default. | ||||||||||||||||||||||||||||||||||||||||||
| 1030 | |||||||||||||||||||||||||||||||||||||||||||
| 1031 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1032 | |||||||||||||||||||||||||||||||||||||||||||
| 1033 | The C<prefetch> option receives one (as scalar) or more (as arrayref) vendor ids. | ||||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||
| 1035 | This is useful when parsing a range based consent string, since we need to visit all ranges to find a particular id. | ||||||||||||||||||||||||||||||||||||||||||
| 1036 | |||||||||||||||||||||||||||||||||||||||||||
| 1037 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1038 | |||||||||||||||||||||||||||||||||||||||||||
| 1039 | C<json> is hashref with the following properties used to customize the json format: | ||||||||||||||||||||||||||||||||||||||||||
| 1040 | |||||||||||||||||||||||||||||||||||||||||||
| 1041 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1042 | |||||||||||||||||||||||||||||||||||||||||||
| 1043 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1044 | |||||||||||||||||||||||||||||||||||||||||||
| 1045 | C<verbose> changes the json encoding. By default we omit some false values such as C<vendor_consents> to create | ||||||||||||||||||||||||||||||||||||||||||
| 1046 | a compact json representation. With C<verbose> we will present everything. See L</TO_JSON> for more details. | ||||||||||||||||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||||||||||||||||
| 1048 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1049 | |||||||||||||||||||||||||||||||||||||||||||
| 1050 | C<compact> changes the json encoding. All fields that are a mapping of something to a boolean will be changed to an array | ||||||||||||||||||||||||||||||||||||||||||
| 1051 | of all elements keys where the value is true. This affects the following fields: C<special_features_opt_in>, | ||||||||||||||||||||||||||||||||||||||||||
| 1052 | C<purpose/consents>, C<purpose/legitimate_interests>, C<vendor/consents> and C<vendor/legitimate_interests>. See L</TO_JSON> for more details. | ||||||||||||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||||||||||||
| 1054 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1055 | |||||||||||||||||||||||||||||||||||||||||||
| 1056 | C<use_epoch> changes the json encode. By default we format the C<created> and C<last_updated> are converted to string using | ||||||||||||||||||||||||||||||||||||||||||
| 1057 | L<ISO_8601|https://en.wikipedia.org/wiki/ISO_8601>. With C<use_epoch> we will return the unix epoch in seconds. | ||||||||||||||||||||||||||||||||||||||||||
| 1058 | See L</TO_JSON> for more details. | ||||||||||||||||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||||||||||||||||
| 1060 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1061 | |||||||||||||||||||||||||||||||||||||||||||
| 1062 | C<boolean_values> if present, expects an arrayref if two elements: the C<false> and the C<true> values to be used in json encoding. | ||||||||||||||||||||||||||||||||||||||||||
| 1063 | If omit, we will try to use C<JSON::false> and C<JSON::true> if the package L<JSON> is available, else we will fallback to C<0> and C<1>. | ||||||||||||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||||||||||
| 1065 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||
| 1067 | C<date_format> if present accepts two kinds of value: an C<string> (to be used on C<POSIX::strftime>) or a code reference to a subroutine that | ||||||||||||||||||||||||||||||||||||||||||
| 1068 | will be called with two arguments: epoch in seconds and nanoseconds. If omitted the format L<ISO_8601|https://en.wikipedia.org/wiki/ISO_8601> will be used | ||||||||||||||||||||||||||||||||||||||||||
| 1069 | except if the option C<use_epoch> is true. | ||||||||||||||||||||||||||||||||||||||||||
| 1070 | |||||||||||||||||||||||||||||||||||||||||||
| 1071 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1072 | |||||||||||||||||||||||||||||||||||||||||||
| 1073 | C<vendor_id> if present, filters the JSON output to only include data for the specific vendor ID. This affects the C<vendor> and C<publisher/restrictions> sections, drastically reducing the size of the output. | ||||||||||||||||||||||||||||||||||||||||||
| 1074 | |||||||||||||||||||||||||||||||||||||||||||
| 1075 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||||||||||||||||
| 1077 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||
| 1079 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 1080 | |||||||||||||||||||||||||||||||||||||||||||
| 1081 | =head2 tc_string | ||||||||||||||||||||||||||||||||||||||||||
| 1082 | |||||||||||||||||||||||||||||||||||||||||||
| 1083 | Returns the original consent string. | ||||||||||||||||||||||||||||||||||||||||||
| 1084 | |||||||||||||||||||||||||||||||||||||||||||
| 1085 | The consent object L<GDPR::IAB::TCFv2::Parser> will call this method on string interpolations. | ||||||||||||||||||||||||||||||||||||||||||
| 1086 | |||||||||||||||||||||||||||||||||||||||||||
| 1087 | =head2 version | ||||||||||||||||||||||||||||||||||||||||||
| 1088 | |||||||||||||||||||||||||||||||||||||||||||
| 1089 | Version number of the encoding format. The value is 2 for this format. | ||||||||||||||||||||||||||||||||||||||||||
| 1090 | |||||||||||||||||||||||||||||||||||||||||||
| 1091 | =head2 created | ||||||||||||||||||||||||||||||||||||||||||
| 1092 | |||||||||||||||||||||||||||||||||||||||||||
| 1093 | Epoch time format when TC String was created in numeric format. You can easily parse with L<DateTime> if needed. | ||||||||||||||||||||||||||||||||||||||||||
| 1094 | |||||||||||||||||||||||||||||||||||||||||||
| 1095 | On scalar context it returns epoch in seconds. On list context it returns epoch in seconds and nanoseconds. | ||||||||||||||||||||||||||||||||||||||||||
| 1096 | |||||||||||||||||||||||||||||||||||||||||||
| 1097 | use GDPR::IAB::TCFv2::Parser; | ||||||||||||||||||||||||||||||||||||||||||
| 1098 | use Test::More tests => 3; | ||||||||||||||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||||||||||||
| 1100 | my $consent = GDPR::IAB::TCFv2::Parser->Parse( | ||||||||||||||||||||||||||||||||||||||||||
| 1101 | 'CLcVDxRMWfGmWAVAHCENAXCkAKDAADnAABRgA5mdfCKZuYJez-NQm0TBMYA4oCAAGQYIAAAAAAEAIAEgAA.argAC0gAAAAAAAAAAAA' | ||||||||||||||||||||||||||||||||||||||||||
| 1102 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1103 | |||||||||||||||||||||||||||||||||||||||||||
| 1104 | is $consent->created, 1228644257, | ||||||||||||||||||||||||||||||||||||||||||
| 1105 | 'should return the creation epoch 07/12/2008'; | ||||||||||||||||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||||||||||||||||
| 1107 | my ( $seconds, $nanoseconds ) = $consent->created; | ||||||||||||||||||||||||||||||||||||||||||
| 1108 | is $seconds, 1228644257, | ||||||||||||||||||||||||||||||||||||||||||
| 1109 | 'should return the creation epoch 07/12/2008 on list context'; | ||||||||||||||||||||||||||||||||||||||||||
| 1110 | is $nanoseconds, 700000000, | ||||||||||||||||||||||||||||||||||||||||||
| 1111 | 'should return the 700000000 nanoseconds of epoch on list context'; | ||||||||||||||||||||||||||||||||||||||||||
| 1112 | |||||||||||||||||||||||||||||||||||||||||||
| 1113 | =head2 last_updated | ||||||||||||||||||||||||||||||||||||||||||
| 1114 | |||||||||||||||||||||||||||||||||||||||||||
| 1115 | Epoch time format when TC String was last updated in numeric format. You can easily parse with L<DateTime> if needed. | ||||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||
| 1117 | On scalar context it returns epoch in seconds. On list context it returns epoch in seconds and nanoseconds, like the C<created> | ||||||||||||||||||||||||||||||||||||||||||
| 1118 | |||||||||||||||||||||||||||||||||||||||||||
| 1119 | =head2 cmp_id | ||||||||||||||||||||||||||||||||||||||||||
| 1120 | |||||||||||||||||||||||||||||||||||||||||||
| 1121 | Consent Management Platform ID that last updated the TC String. Is a unique ID will be assigned to each Consent Management Platform. | ||||||||||||||||||||||||||||||||||||||||||
| 1122 | |||||||||||||||||||||||||||||||||||||||||||
| 1123 | =head2 cmp_version | ||||||||||||||||||||||||||||||||||||||||||
| 1124 | |||||||||||||||||||||||||||||||||||||||||||
| 1125 | Consent Management Platform version of the CMP that last updated this TC String. | ||||||||||||||||||||||||||||||||||||||||||
| 1126 | Each change to a CMP should increment their internally assigned version number as a record of which version the user gave consent and transparency was established. | ||||||||||||||||||||||||||||||||||||||||||
| 1127 | |||||||||||||||||||||||||||||||||||||||||||
| 1128 | =head2 consent_screen | ||||||||||||||||||||||||||||||||||||||||||
| 1129 | |||||||||||||||||||||||||||||||||||||||||||
| 1130 | CMP Screen number at which consent was given for a user with the CMP that last updated this TC String. | ||||||||||||||||||||||||||||||||||||||||||
| 1131 | The number is a CMP internal designation and is CmpVersion specific. The number is used for identifying on which screen a user gave consent as a record. | ||||||||||||||||||||||||||||||||||||||||||
| 1132 | |||||||||||||||||||||||||||||||||||||||||||
| 1133 | =head2 consent_language | ||||||||||||||||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||||||||||||||||
| 1135 | Two-letter L<ISO 639-1|https://en.wikipedia.org/wiki/ISO_639-1> language code in which the CMP UI was presented. | ||||||||||||||||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||||||||||||||||
| 1137 | =head2 vendor_list_version | ||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||
| 1139 | Number corresponds to L<GVL|https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20Consent%20string%20and%20vendor%20list%20formats%20v2.md#the-global-vendor-list> vendorListVersion. | ||||||||||||||||||||||||||||||||||||||||||
| 1140 | Version of the GVL used to create this TC String. | ||||||||||||||||||||||||||||||||||||||||||
| 1141 | |||||||||||||||||||||||||||||||||||||||||||
| 1142 | =head2 policy_version | ||||||||||||||||||||||||||||||||||||||||||
| 1143 | |||||||||||||||||||||||||||||||||||||||||||
| 1144 | Version of policy used within L<GVL|https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20Consent%20string%20and%20vendor%20list%20formats%20v2.md#the-global-vendor-list>. | ||||||||||||||||||||||||||||||||||||||||||
| 1145 | |||||||||||||||||||||||||||||||||||||||||||
| 1146 | From the corresponding field in the GVL that was used for obtaining consent. | ||||||||||||||||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||||||||||||||||
| 1148 | =head2 is_v22_plus | ||||||||||||||||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||||||||||||||||
| 1150 | Returns true if the TC string uses Policy Version 4 or higher (TCF v2.2+). | ||||||||||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||||||||||
| 1152 | =head2 is_v23 | ||||||||||||||||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||||||||||||||
| 1154 | Returns true if the TC string uses Policy Version 5 or higher (TCF v2.3). | ||||||||||||||||||||||||||||||||||||||||||
| 1155 | |||||||||||||||||||||||||||||||||||||||||||
| 1156 | =head2 is_service_specific | ||||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||
| 1158 | This field must always have the value of 1. When a Vendor encounters a TC String with C<is_service_specific=0> then it is considered invalid. | ||||||||||||||||||||||||||||||||||||||||||
| 1159 | |||||||||||||||||||||||||||||||||||||||||||
| 1160 | =head2 use_non_standard_stacks | ||||||||||||||||||||||||||||||||||||||||||
| 1161 | |||||||||||||||||||||||||||||||||||||||||||
| 1162 | If true, CMP used non-IAB standard texts during consent gathering. | ||||||||||||||||||||||||||||||||||||||||||
| 1163 | |||||||||||||||||||||||||||||||||||||||||||
| 1164 | Setting this to 1 signals to Vendors that a private CMP has modified standard Stack descriptions and/or their translations and/or that a CMP has modified or supplemented standard Illustrations and/or their translations as allowed by the policy.. | ||||||||||||||||||||||||||||||||||||||||||
| 1165 | |||||||||||||||||||||||||||||||||||||||||||
| 1166 | =head2 is_special_feature_opt_in | ||||||||||||||||||||||||||||||||||||||||||
| 1167 | |||||||||||||||||||||||||||||||||||||||||||
| 1168 | If true means Opt in. | ||||||||||||||||||||||||||||||||||||||||||
| 1169 | |||||||||||||||||||||||||||||||||||||||||||
| 1170 | The TCF L<Policies|https://iabeurope.eu/iab-europe-transparency-consent-framework-policies/> designates certain Features as "special" which means a CMP must afford the user a means to opt in to their use. These "Special Features" are published and numerically identified in the L<Global Vendor List separately|https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20Consent%20string%20and%20vendor%20list%20formats%20v2.md#the-global-vendor-list> from normal Features. | ||||||||||||||||||||||||||||||||||||||||||
| 1171 | |||||||||||||||||||||||||||||||||||||||||||
| 1172 | See also: L<GDPR::IAB::TCFv2::Constants::SpecialFeature>. | ||||||||||||||||||||||||||||||||||||||||||
| 1173 | |||||||||||||||||||||||||||||||||||||||||||
| 1174 | =head2 is_purpose_consent_allowed | ||||||||||||||||||||||||||||||||||||||||||
| 1175 | |||||||||||||||||||||||||||||||||||||||||||
| 1176 | If true means Consent. | ||||||||||||||||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||||||||||||||||
| 1178 | The user's consent value for each Purpose established on the legal basis of consent. | ||||||||||||||||||||||||||||||||||||||||||
| 1179 | Accepts one or more Purpose IDs. Returns true if all Purposes have consent. | ||||||||||||||||||||||||||||||||||||||||||
| 1180 | |||||||||||||||||||||||||||||||||||||||||||
| 1181 | my $ok = $instance->is_purpose_consent_allowed(1); | ||||||||||||||||||||||||||||||||||||||||||
| 1182 | my $all_ok = $instance->is_purpose_consent_allowed(1, 2, 3); | ||||||||||||||||||||||||||||||||||||||||||
| 1183 | |||||||||||||||||||||||||||||||||||||||||||
| 1184 | Throws an exception if no arguments are provided or if an ID is invalid. | ||||||||||||||||||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||||||||||||||||
| 1186 | See also: L<GDPR::IAB::TCFv2::Constants::Purpose>. | ||||||||||||||||||||||||||||||||||||||||||
| 1187 | |||||||||||||||||||||||||||||||||||||||||||
| 1188 | =head2 is_purpose_legitimate_interest_allowed | ||||||||||||||||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||||||||||||||
| 1190 | The user's consent value for each Purpose established on the legal basis of legitimate interest. | ||||||||||||||||||||||||||||||||||||||||||
| 1191 | Accepts one or more Purpose IDs. Returns true if all Purposes have legitimate interest. | ||||||||||||||||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||||||||||||||||
| 1193 | my $ok = $instance->is_purpose_legitimate_interest_allowed(1); | ||||||||||||||||||||||||||||||||||||||||||
| 1194 | my $all_ok = $instance->is_purpose_legitimate_interest_allowed(1, 2, 3); | ||||||||||||||||||||||||||||||||||||||||||
| 1195 | |||||||||||||||||||||||||||||||||||||||||||
| 1196 | Throws an exception if no arguments are provided or if an ID is invalid. | ||||||||||||||||||||||||||||||||||||||||||
| 1197 | |||||||||||||||||||||||||||||||||||||||||||
| 1198 | See also: L<GDPR::IAB::TCFv2::Constants::Purpose>. | ||||||||||||||||||||||||||||||||||||||||||
| 1199 | |||||||||||||||||||||||||||||||||||||||||||
| 1200 | =head2 purpose_one_treatment | ||||||||||||||||||||||||||||||||||||||||||
| 1201 | |||||||||||||||||||||||||||||||||||||||||||
| 1202 | CMPs can use the C<publisher_country_code> field to indicate the legal jurisdiction the publisher is under to help vendors determine whether the vendor needs consent for Purpose 1. | ||||||||||||||||||||||||||||||||||||||||||
| 1203 | |||||||||||||||||||||||||||||||||||||||||||
| 1204 | Returns true if Purpose 1 was NOT disclosed at all. | ||||||||||||||||||||||||||||||||||||||||||
| 1205 | |||||||||||||||||||||||||||||||||||||||||||
| 1206 | Returns false if Purpose 1 was disclosed commonly as consent as expected by the L<Policies|https://iabeurope.eu/iab-europe-transparency-consent-framework-policies/>. | ||||||||||||||||||||||||||||||||||||||||||
| 1207 | |||||||||||||||||||||||||||||||||||||||||||
| 1208 | =head2 publisher_country_code | ||||||||||||||||||||||||||||||||||||||||||
| 1209 | |||||||||||||||||||||||||||||||||||||||||||
| 1210 | Two-letter L<ISO 639-1|https://en.wikipedia.org/wiki/ISO_639-1> language code of the country that determines legislation of reference. | ||||||||||||||||||||||||||||||||||||||||||
| 1211 | Commonly, this corresponds to the country in which the publisher's business entity is established. | ||||||||||||||||||||||||||||||||||||||||||
| 1212 | |||||||||||||||||||||||||||||||||||||||||||
| 1213 | =head2 max_vendor_id_consent | ||||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||
| 1215 | The maximum Vendor ID that is represented in the following bit field or range encoding. | ||||||||||||||||||||||||||||||||||||||||||
| 1216 | |||||||||||||||||||||||||||||||||||||||||||
| 1217 | Because this section can be a variable length, this indicates the last ID of the section so that a decoder will know when it has reached the end. | ||||||||||||||||||||||||||||||||||||||||||
| 1218 | |||||||||||||||||||||||||||||||||||||||||||
| 1219 | =head2 vendor_consent | ||||||||||||||||||||||||||||||||||||||||||
| 1220 | |||||||||||||||||||||||||||||||||||||||||||
| 1221 | If true, vendor has consent. | ||||||||||||||||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||||||||||||||||
| 1223 | The consent value for each Vendor ID. | ||||||||||||||||||||||||||||||||||||||||||
| 1224 | |||||||||||||||||||||||||||||||||||||||||||
| 1225 | my $ok = $instance->vendor_consent(284); # if true, consent ok for Weborama (vendor id 284). | ||||||||||||||||||||||||||||||||||||||||||
| 1226 | |||||||||||||||||||||||||||||||||||||||||||
| 1227 | =head2 max_vendor_id_legitimate_interest | ||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||
| 1229 | The maximum Vendor ID that is represented in the following bit field or range encoding. | ||||||||||||||||||||||||||||||||||||||||||
| 1230 | |||||||||||||||||||||||||||||||||||||||||||
| 1231 | Because this section can be a variable length, this indicates the last ID of the section so that a decoder will know when it has reached the end. | ||||||||||||||||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||||||||||||||||
| 1233 | =head2 vendor_legitimate_interest | ||||||||||||||||||||||||||||||||||||||||||
| 1234 | |||||||||||||||||||||||||||||||||||||||||||
| 1235 | If true, legitimate interest established. | ||||||||||||||||||||||||||||||||||||||||||
| 1236 | |||||||||||||||||||||||||||||||||||||||||||
| 1237 | The legitimate interest value for each Vendor ID | ||||||||||||||||||||||||||||||||||||||||||
| 1238 | |||||||||||||||||||||||||||||||||||||||||||
| 1239 | my $ok = $instance->vendor_legitimate_interest(284); # if true, legitimate interest established for Weborama (vendor id 284). | ||||||||||||||||||||||||||||||||||||||||||
| 1240 | |||||||||||||||||||||||||||||||||||||||||||
| 1241 | =head2 disclosed_vendor | ||||||||||||||||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||||||||||||||||
| 1243 | If true, the vendor was disclosed to the user (Segment 1 or 5). | ||||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||
| 1245 | say "Vendor 284 was disclosed" if $consent->disclosed_vendor(284); | ||||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||
| 1247 | =head2 has_vendor_disclosure | ||||||||||||||||||||||||||||||||||||||||||
| 1248 | |||||||||||||||||||||||||||||||||||||||||||
| 1249 | Returns true (1) if the TC string contains a "Disclosed Vendors" segment (ID 1 or 5), and false (0) otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 1250 | |||||||||||||||||||||||||||||||||||||||||||
| 1251 | =head2 allowed_vendor | ||||||||||||||||||||||||||||||||||||||||||
| 1252 | |||||||||||||||||||||||||||||||||||||||||||
| 1253 | If true, the vendor is in the "Allowed Vendors" segment (Segment 2). This is typically used for service-specific TC strings. | ||||||||||||||||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||||||||||||||||
| 1255 | say "Vendor 284 is allowed" if $consent->allowed_vendor(284); | ||||||||||||||||||||||||||||||||||||||||||
| 1256 | |||||||||||||||||||||||||||||||||||||||||||
| 1257 | =head2 is_vendor_consent_allowed | ||||||||||||||||||||||||||||||||||||||||||
| 1258 | |||||||||||||||||||||||||||||||||||||||||||
| 1259 | Check if a vendor has consent for a list of purposes, respecting publisher restrictions. | ||||||||||||||||||||||||||||||||||||||||||
| 1260 | |||||||||||||||||||||||||||||||||||||||||||
| 1261 | if ($consent->is_vendor_consent_allowed(284, 1, 2, 3)) { | ||||||||||||||||||||||||||||||||||||||||||
| 1262 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 1263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1264 | |||||||||||||||||||||||||||||||||||||||||||
| 1265 | =head2 is_vendor_legitimate_interest_allowed | ||||||||||||||||||||||||||||||||||||||||||
| 1266 | |||||||||||||||||||||||||||||||||||||||||||
| 1267 | Check if a vendor has legitimate interest for a list of purposes, respecting publisher restrictions. | ||||||||||||||||||||||||||||||||||||||||||
| 1268 | |||||||||||||||||||||||||||||||||||||||||||
| 1269 | if ($consent->is_vendor_legitimate_interest_allowed(284, 2, 4)) { | ||||||||||||||||||||||||||||||||||||||||||
| 1270 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 1271 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1272 | |||||||||||||||||||||||||||||||||||||||||||
| 1273 | =head2 is_vendor_allowed_for_any_basis | ||||||||||||||||||||||||||||||||||||||||||
| 1274 | |||||||||||||||||||||||||||||||||||||||||||
| 1275 | Check if a vendor has either consent or legitimate interest for a list of purposes, respecting publisher restrictions. | ||||||||||||||||||||||||||||||||||||||||||
| 1276 | |||||||||||||||||||||||||||||||||||||||||||
| 1277 | if ($consent->is_vendor_allowed_for_any_basis(284, 1, 2)) { | ||||||||||||||||||||||||||||||||||||||||||
| 1278 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 1279 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1280 | |||||||||||||||||||||||||||||||||||||||||||
| 1281 | =head2 has_publisher_restrictions | ||||||||||||||||||||||||||||||||||||||||||
| 1282 | |||||||||||||||||||||||||||||||||||||||||||
| 1283 | Returns true (1) if the TC string contains a "Publisher Restrictions" section, and false (0) otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 1284 | |||||||||||||||||||||||||||||||||||||||||||
| 1285 | =head2 check_publisher_restriction | ||||||||||||||||||||||||||||||||||||||||||
| 1286 | |||||||||||||||||||||||||||||||||||||||||||
| 1287 | It true, there is a publisher restriction of certain type, for a given purpose id, for a given vendor id: | ||||||||||||||||||||||||||||||||||||||||||
| 1288 | |||||||||||||||||||||||||||||||||||||||||||
| 1289 | # return true if there is publisher restriction to vendor 284 regarding purpose id 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1290 | # with restriction type 0 'Purpose Flatly Not Allowed by Publisher' | ||||||||||||||||||||||||||||||||||||||||||
| 1291 | my $ok = $instance->check_publisher_restriction(1, 0, 284); | ||||||||||||||||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||||||||||||||||
| 1293 | or | ||||||||||||||||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||||||||||||||||
| 1295 | my $ok = $instance->check_publisher_restriction( | ||||||||||||||||||||||||||||||||||||||||||
| 1296 | purpose_id => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 1297 | restriction_type => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 1298 | vendor_id => 284); | ||||||||||||||||||||||||||||||||||||||||||
| 1299 | |||||||||||||||||||||||||||||||||||||||||||
| 1300 | Version 2.0 of the Framework introduced the ability for publishers to signal restrictions on how vendors may process personal data. Restrictions can be of two types: | ||||||||||||||||||||||||||||||||||||||||||
| 1301 | |||||||||||||||||||||||||||||||||||||||||||
| 1302 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1303 | |||||||||||||||||||||||||||||||||||||||||||
| 1304 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1305 | |||||||||||||||||||||||||||||||||||||||||||
| 1306 | Purposes. Restrict the purposes for which personal data is processed by a vendor. | ||||||||||||||||||||||||||||||||||||||||||
| 1307 | |||||||||||||||||||||||||||||||||||||||||||
| 1308 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1309 | |||||||||||||||||||||||||||||||||||||||||||
| 1310 | Legal basis. Specify the legal basis upon which a publisher requires a vendor to operate where a vendor has signaled flexibility on legal basis in the GVL. | ||||||||||||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||||||||||||
| 1312 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1313 | |||||||||||||||||||||||||||||||||||||||||||
| 1314 | Publisher restrictions are custom requirements specified by a publisher. In order for vendors to determine if processing is permissible at all for a specific purpose or which legal basis is applicable (in case they signaled flexibility in the GVL) restrictions must be respected. | ||||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||
| 1316 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1317 | |||||||||||||||||||||||||||||||||||||||||||
| 1318 | =item 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1319 | |||||||||||||||||||||||||||||||||||||||||||
| 1320 | Vendors must always respect a restriction signal that disallows them the processing for a specific purpose regardless of whether or not they have declared that purpose to be "flexible". | ||||||||||||||||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||||||||||||||||
| 1322 | =item 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||||||||||||||||
| 1324 | Vendors that declared a purpose with a default legal basis (consent or legitimate interest respectively) but also declared this purpose as flexible must respect a legal basis restriction if present. That means for example in case they declared a purpose as legitimate interest but also declared that purpose as flexible and there is a legal basis restriction to require consent, they must then check for the consent signal and must not apply the legitimate interest signal. | ||||||||||||||||||||||||||||||||||||||||||
| 1325 | |||||||||||||||||||||||||||||||||||||||||||
| 1326 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1327 | |||||||||||||||||||||||||||||||||||||||||||
| 1328 | For the avoidance of doubt: | ||||||||||||||||||||||||||||||||||||||||||
| 1329 | |||||||||||||||||||||||||||||||||||||||||||
| 1330 | In case a vendor has declared flexibility for a purpose and there is no legal basis restriction signal it must always apply the default legal basis under which the purpose was registered aside from being registered as flexible. That means if a vendor declared a purpose as legitimate interest and also declared that purpose as flexible it may not apply a "consent" signal without a legal basis restriction signal to require consent. | ||||||||||||||||||||||||||||||||||||||||||
| 1331 | |||||||||||||||||||||||||||||||||||||||||||
| 1332 | =head2 is_vendor_allowed_for_flexible_purpose | ||||||||||||||||||||||||||||||||||||||||||
| 1333 | |||||||||||||||||||||||||||||||||||||||||||
| 1334 | Check if a vendor is allowed for a flexible purpose, given a default legal basis (true if Legitimate Interest, false if Consent). | ||||||||||||||||||||||||||||||||||||||||||
| 1335 | |||||||||||||||||||||||||||||||||||||||||||
| 1336 | if ($consent->is_vendor_allowed_for_flexible_purpose(284, 2, 1)) { | ||||||||||||||||||||||||||||||||||||||||||
| 1337 | # vendor 284, purpose 2, default is LI | ||||||||||||||||||||||||||||||||||||||||||
| 1338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1339 | |||||||||||||||||||||||||||||||||||||||||||
| 1340 | =head2 publisher_restrictions | ||||||||||||||||||||||||||||||||||||||||||
| 1341 | |||||||||||||||||||||||||||||||||||||||||||
| 1342 | Similar to L</check_publisher_restriction> but return an hashref of purpose => { restriction type => bool } for a given vendor. | ||||||||||||||||||||||||||||||||||||||||||
| 1343 | |||||||||||||||||||||||||||||||||||||||||||
| 1344 | =head2 publisher_tc | ||||||||||||||||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||||||||||||||||
| 1346 | If the consent string has a C<Publisher TC> section, we will decode this section as an instance of L<GDPR::IAB::TCFv2::PublisherTC>. | ||||||||||||||||||||||||||||||||||||||||||
| 1347 | |||||||||||||||||||||||||||||||||||||||||||
| 1348 | Will return undefined if there is no C<Publisher TC> section. | ||||||||||||||||||||||||||||||||||||||||||
| 1349 | |||||||||||||||||||||||||||||||||||||||||||
| 1350 | =head2 TO_JSON | ||||||||||||||||||||||||||||||||||||||||||
| 1351 | |||||||||||||||||||||||||||||||||||||||||||
| 1352 | Will serialize the consent object into a hash reference. The objective is to be used by L<JSON> package. | ||||||||||||||||||||||||||||||||||||||||||
| 1353 | |||||||||||||||||||||||||||||||||||||||||||
| 1354 | With option C<convert_blessed>, the encoder will call this method. | ||||||||||||||||||||||||||||||||||||||||||
| 1355 | |||||||||||||||||||||||||||||||||||||||||||
| 1356 | use warnings; | ||||||||||||||||||||||||||||||||||||||||||
| 1357 | use feature qw<say>; | ||||||||||||||||||||||||||||||||||||||||||
| 1358 | |||||||||||||||||||||||||||||||||||||||||||
| 1359 | use JSON; | ||||||||||||||||||||||||||||||||||||||||||
| 1360 | use DateTime; | ||||||||||||||||||||||||||||||||||||||||||
| 1361 | use DateTimeX::TO_JSON formatter => 'DateTime::Format::RFC3339'; | ||||||||||||||||||||||||||||||||||||||||||
| 1362 | use GDPR::IAB::TCFv2::Parser; | ||||||||||||||||||||||||||||||||||||||||||
| 1363 | |||||||||||||||||||||||||||||||||||||||||||
| 1364 | my $consent = GDPR::IAB::TCFv2::Parser->Parse( | ||||||||||||||||||||||||||||||||||||||||||
| 1365 | 'COyiILmOyiILmADACHENAPCAAAAAAAAAAAAAE5QBgALgAqgD8AQACSwEygJyAAAAAA.argAC0gAAAAAAAAAAAA', | ||||||||||||||||||||||||||||||||||||||||||
| 1366 | json => { | ||||||||||||||||||||||||||||||||||||||||||
| 1367 | compact => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 1368 | date_format => sub { # can be omitted, with DateTimeX::TO_JSON | ||||||||||||||||||||||||||||||||||||||||||
| 1369 | my ( $epoch, $ns ) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1370 | |||||||||||||||||||||||||||||||||||||||||||
| 1371 | return DateTime->from_epoch( epoch => $epoch ) | ||||||||||||||||||||||||||||||||||||||||||
| 1372 | ->set_nanosecond($ns); | ||||||||||||||||||||||||||||||||||||||||||
| 1373 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 1374 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 1375 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1376 | |||||||||||||||||||||||||||||||||||||||||||
| 1377 | my $json = JSON->new->convert_blessed; | ||||||||||||||||||||||||||||||||||||||||||
| 1378 | my $encoded = $json->pretty->encode($consent); | ||||||||||||||||||||||||||||||||||||||||||
| 1379 | |||||||||||||||||||||||||||||||||||||||||||
| 1380 | say $encoded; | ||||||||||||||||||||||||||||||||||||||||||
| 1381 | |||||||||||||||||||||||||||||||||||||||||||
| 1382 | Outputs: | ||||||||||||||||||||||||||||||||||||||||||
| 1383 | |||||||||||||||||||||||||||||||||||||||||||
| 1384 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1385 | "tc_string" : "COyiILmOyiILmADACHENAPCAAAAAAAAAAAAAE5QBgALgAqgD8AQACSwEygJyAAAAAA", | ||||||||||||||||||||||||||||||||||||||||||
| 1386 | "consent_language" : "EN", | ||||||||||||||||||||||||||||||||||||||||||
| 1387 | "purpose" : { | ||||||||||||||||||||||||||||||||||||||||||
| 1388 | "consents" : [], | ||||||||||||||||||||||||||||||||||||||||||
| 1389 | "legitimate_interests" : [] | ||||||||||||||||||||||||||||||||||||||||||
| 1390 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 1391 | "cmp_id" : 3, | ||||||||||||||||||||||||||||||||||||||||||
| 1392 | "purpose_one_treatment" : false, | ||||||||||||||||||||||||||||||||||||||||||
| 1393 | "publisher" : { | ||||||||||||||||||||||||||||||||||||||||||
| 1394 | "consents" : [ | ||||||||||||||||||||||||||||||||||||||||||
| 1395 | 2, | ||||||||||||||||||||||||||||||||||||||||||
| 1396 | 4, | ||||||||||||||||||||||||||||||||||||||||||
| 1397 | 6, | ||||||||||||||||||||||||||||||||||||||||||
| 1398 | 8, | ||||||||||||||||||||||||||||||||||||||||||
| 1399 | 9, | ||||||||||||||||||||||||||||||||||||||||||
| 1400 | 10 | ||||||||||||||||||||||||||||||||||||||||||
| 1401 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 1402 | "legitimate_interests" : [ | ||||||||||||||||||||||||||||||||||||||||||
| 1403 | 2, | ||||||||||||||||||||||||||||||||||||||||||
| 1404 | 4, | ||||||||||||||||||||||||||||||||||||||||||
| 1405 | 5, | ||||||||||||||||||||||||||||||||||||||||||
| 1406 | 7, | ||||||||||||||||||||||||||||||||||||||||||
| 1407 | 10 | ||||||||||||||||||||||||||||||||||||||||||
| 1408 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 1409 | "custom_purposes" : { | ||||||||||||||||||||||||||||||||||||||||||
| 1410 | "consents" : [], | ||||||||||||||||||||||||||||||||||||||||||
| 1411 | "legitimate_interests" : [] | ||||||||||||||||||||||||||||||||||||||||||
| 1412 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 1413 | "restrictions" : {} | ||||||||||||||||||||||||||||||||||||||||||
| 1414 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 1415 | "special_features_opt_in" : [], | ||||||||||||||||||||||||||||||||||||||||||
| 1416 | "last_updated" : "2020-04-27T20:27:54.200000000Z", | ||||||||||||||||||||||||||||||||||||||||||
| 1417 | "use_non_standard_stacks" : false, | ||||||||||||||||||||||||||||||||||||||||||
| 1418 | "policy_version" : 2, | ||||||||||||||||||||||||||||||||||||||||||
| 1419 | "version" : 2, | ||||||||||||||||||||||||||||||||||||||||||
| 1420 | "is_service_specific" : false, | ||||||||||||||||||||||||||||||||||||||||||
| 1421 | "created" : "2020-04-27T20:27:54.200000000Z", | ||||||||||||||||||||||||||||||||||||||||||
| 1422 | "consent_screen" : 7, | ||||||||||||||||||||||||||||||||||||||||||
| 1423 | "vendor_list_version" : 15, | ||||||||||||||||||||||||||||||||||||||||||
| 1424 | "cmp_version" : 2, | ||||||||||||||||||||||||||||||||||||||||||
| 1425 | "publisher_country_code" : "AA", | ||||||||||||||||||||||||||||||||||||||||||
| 1426 | "vendor" : { | ||||||||||||||||||||||||||||||||||||||||||
| 1427 | "consents" : [ | ||||||||||||||||||||||||||||||||||||||||||
| 1428 | 23, | ||||||||||||||||||||||||||||||||||||||||||
| 1429 | 42, | ||||||||||||||||||||||||||||||||||||||||||
| 1430 | 126, | ||||||||||||||||||||||||||||||||||||||||||
| 1431 | 127, | ||||||||||||||||||||||||||||||||||||||||||
| 1432 | 128, | ||||||||||||||||||||||||||||||||||||||||||
| 1433 | 587, | ||||||||||||||||||||||||||||||||||||||||||
| 1434 | 613, | ||||||||||||||||||||||||||||||||||||||||||
| 1435 | 626 | ||||||||||||||||||||||||||||||||||||||||||
| 1436 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 1437 | "legitimate_interests" : [] | ||||||||||||||||||||||||||||||||||||||||||
| 1438 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1439 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1440 | |||||||||||||||||||||||||||||||||||||||||||
| 1441 | |||||||||||||||||||||||||||||||||||||||||||
| 1442 | If L<JSON> is installed, the L</TO_JSON> method will use C<JSON::true> and C<JSON::false> as boolean value. | ||||||||||||||||||||||||||||||||||||||||||
| 1443 | |||||||||||||||||||||||||||||||||||||||||||
| 1444 | By default it returns a compacted format where we omit the C<false> on fields like C<vendor_consents> and we convert the dates | ||||||||||||||||||||||||||||||||||||||||||
| 1445 | using L<ISO_8601|https://en.wikipedia.org/wiki/ISO_8601>. This behaviour can be changed by extra option in the L<Parse> constructor. | ||||||||||||||||||||||||||||||||||||||||||
| 1446 | |||||||||||||||||||||||||||||||||||||||||||
| 1447 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 1448 | |||||||||||||||||||||||||||||||||||||||||||
| 1449 | L<GDPR::IAB::TCFv2> for the documentation hub and project overview. | ||||||||||||||||||||||||||||||||||||||||||
| 1450 | |||||||||||||||||||||||||||||||||||||||||||
| 1451 | L<GDPR::IAB::TCFv2::Validator> for declarative compliance checks. | ||||||||||||||||||||||||||||||||||||||||||
| 1452 | |||||||||||||||||||||||||||||||||||||||||||
| 1453 | L<GDPR::IAB::TCFv2::CMPValidator> for CMP-list validation. | ||||||||||||||||||||||||||||||||||||||||||
| 1454 | |||||||||||||||||||||||||||||||||||||||||||
| 1455 | L<iabtcfv2> for one-liner / shell-use shortcuts. | ||||||||||||||||||||||||||||||||||||||||||
| 1456 | |||||||||||||||||||||||||||||||||||||||||||
| 1457 | The original IAB documentation of L<TCF v2|https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20Consent%20string%20and%20vendor%20list%20formats%20v2.md>. | ||||||||||||||||||||||||||||||||||||||||||
| 1458 | |||||||||||||||||||||||||||||||||||||||||||
| 1459 | =cut | ||||||||||||||||||||||||||||||||||||||||||