NAME

GDPR::IAB::TCFv2::RangeSection - Transparency & Consent String version 2 range section parser

SYNOPSIS

my $data = unpack "B*", decode_base64url('tcf v2 consent string base64 encoded');

my $max_id_consent = << get 16 bits from $data offset 213 >>

my ($range_section, $next_offset) = GDPR::IAB::TCFv2::RangeSection->Parse(
    data          => $data,
    offset     => 230,                      # offset for vendor ranges
    max_id => $max_id_consent,
);

if $range_section->contains(284) { ... }

CONSTRUCTOR

Constructor Parse receives 3 parameters: data (as sequence of bits), start bit offset and vendor bits required (max vendor id).

Will die if any parameter is missing.

Will die if data does not contain all bits required.

Will die if the range sections are malformed.

Will return an array of two elements: the object itself and the next offset.

METHODS

contains

Return the vendor id bit status (if enable or not) from one of the range sections.

Will return false if id is bigger than max vendor id.

my $ok = $range_section->contains(284);

max_id

Returns the max vendor id.

all

Returns an arrayref of all vendors mapped with the bit enabled.