diff --git a/Changes b/Changes index e098a25..6208fb0 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ + - change subroutine redefinition from INIT to BEGIN to avoid warnings (Tiago) + 0.200 - refactor constants, stop use dualvars - validate parameters on method check_publisher_restriction diff --git a/lib/GDPR/IAB/TCFv2.pm b/lib/GDPR/IAB/TCFv2.pm index 1367283..cc1aae6 100644 --- a/lib/GDPR/IAB/TCFv2.pm +++ b/lib/GDPR/IAB/TCFv2.pm @@ -62,31 +62,6 @@ use constant { use overload q<""> => \&tc_string; -INIT { - if ( my $native_decode_base64url = MIME::Base64->can("decode_base64url") ) - { - no warnings q; - - *_decode_base64url = $native_decode_base64url; - } - - eval { - require JSON; - - if ( my $native_json_true = JSON->can("true") ) { - no warnings q; - - *_json_true = $native_json_true; - } - - if ( my $native_json_false = JSON->can("false") ) { - no warnings q; - - *_json_false = $native_json_false; - } - }; -} - # ABSTRACT: gdpr iab tcf v2 consent string parser sub Parse { @@ -647,6 +622,32 @@ sub looksLikeIsConsentVersion2 { rindex( $gdpr_consent_string, CONSENT_STRING_TCF_V2->{PREFIX}, 0 ) == 0; } +BEGIN { + if ( my $native_decode_base64url = MIME::Base64->can("decode_base64url") ) + { + no warnings q; + + *_decode_base64url = $native_decode_base64url; + } + + eval { + require JSON; + + if ( my $native_json_true = JSON->can("true") ) { + no warnings q; + + *_json_true = $native_json_true; + } + + if ( my $native_json_false = JSON->can("false") ) { + no warnings q; + + *_json_false = $native_json_false; + } + }; +} + + 1; __END__