NAME
GDPR::IAB::TCFv2::Validator::Result - outcome object returned by GDPR::IAB::TCFv2::Validator
SYNOPSIS
my $result = $validator->validate($tc_string);
if ($result) {
# Validation passed.
}
else {
warn "$result\n"; # one reason per line by default
for my $reason ( $result->reasons ) { ... }
}
# Use Perl's output record separator to control how reasons join:
{
local $\ = " | ";
print "$result"; # "reason1 | reason2"
}
DESCRIPTION
A small immutable carrier for the outcome of a "validate" in GDPR::IAB::TCFv2::Validator or "validate_all" in GDPR::IAB::TCFv2::Validator run. It overloads boolean and string contexts so it drops into typical error-handling idioms without an explicit accessor call.
OVERLOADS
Boolean
if ($result) { ... }
if (!$result) { ... }
True when validation passed (no rules failed); false otherwise.
Stringification
print "$result\n";
Returns the empty string for a passing result. For a failing result, returns the failure reasons joined by Perl's output record separator ($\); if $\ is undefined, reasons are joined by "\n".
This means:
print "$result\n"; # one reason per line
local $\ = " | ";
print "$result\n"; # "reason1 | reason2"
aligns naturally with the way print would have laid out the reasons if you had iterated and printed them yourself.
METHODS
is_valid
my $ok = $result->is_valid;
Returns truthy for a passing result, falsy otherwise. Equivalent to the boolean overload but available as an explicit method for callers that prefer it.
reasons
my @reasons = $result->reasons;
Returns the list of human-readable failure reasons. Empty for a passing result.
CONSTRUCTOR
new
Internal — construct via "validate" in GDPR::IAB::TCFv2::Validator rather than directly.