Skip to content

Commit

Permalink
fix issue #9 by trying to use MIME::Base64->can("decode_base64url") o…
Browse files Browse the repository at this point in the history
…r use a fallback
  • Loading branch information
peczenyj committed Dec 4, 2023
1 parent 77cde2b commit f0a64b0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/GDPR/IAB/TCFv2.pm
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,15 @@ sub _get_core_tc_string {

sub _decode_base64url {
my $s = shift;
$s =~ tr[-_][+/];
$s .= '=' while length($s) % 4;
return decode_base64($s);

state $decode_base64url = MIME::Base64->can("decode_base64url") || sub {
my $s = shift;
$s =~ tr[-_][+/];
$s .= '=' while length($s) % 4;
return decode_base64($s);
};

return $decode_base64url->($s);
}

sub version {
Expand Down

0 comments on commit f0a64b0

Please sign in to comment.