From 4f95f9a96ead784461e678aaad41ed28a210170c Mon Sep 17 00:00:00 2001 From: James Raspass Date: Tue, 13 Aug 2024 11:10:59 +0100 Subject: [PATCH] Remove obsolete perl 5.6 hacks Remove the monkey-patching of utf8 and then the require of utf8 because as per the docs you shouldn't load utf8 to use its functions. Also remove a couple of stray old version requirements, in both cases the files load DBI.pm which has a greater 5.8 require. --- DBI.pm | 9 --------- lib/DBI/ProxyServer.pm | 1 - lib/DBI/PurePerl.pm | 7 ------- t/80proxy.t | 1 - 4 files changed, 18 deletions(-) diff --git a/DBI.pm b/DBI.pm index 522b2b3c..eee169cb 100644 --- a/DBI.pm +++ b/DBI.pm @@ -1132,10 +1132,6 @@ sub data_string_diff { if !defined $b; } - require utf8; - # hack to cater for perl 5.6 - *utf8::is_utf8 = sub { (DBI::neat(shift)=~/^"/) } unless defined &utf8::is_utf8; - my @a_chars = (utf8::is_utf8($a)) ? unpack("U*", $a) : unpack("C*", $a); my @b_chars = (utf8::is_utf8($b)) ? unpack("U*", $b) : unpack("C*", $b); my $i = 0; @@ -1165,11 +1161,6 @@ sub data_string_diff { sub data_string_desc { # describe a data string my ($a) = @_; require bytes; - require utf8; - - # hacks to cater for perl 5.6 - *utf8::is_utf8 = sub { (DBI::neat(shift)=~/^"/) } unless defined &utf8::is_utf8; - *utf8::valid = sub { 1 } unless defined &utf8::valid; # Give sufficient info to help diagnose at least these kinds of situations: # - valid UTF8 byte sequence but UTF8 flag not set diff --git a/lib/DBI/ProxyServer.pm b/lib/DBI/ProxyServer.pm index ef218497..f399164a 100644 --- a/lib/DBI/ProxyServer.pm +++ b/lib/DBI/ProxyServer.pm @@ -22,7 +22,6 @@ ############################################################################## -require 5.004; use strict; use RPC::PlServer 0.2001; diff --git a/lib/DBI/PurePerl.pm b/lib/DBI/PurePerl.pm index d07ff3f6..86445e7b 100644 --- a/lib/DBI/PurePerl.pm +++ b/lib/DBI/PurePerl.pm @@ -20,13 +20,6 @@ use strict; use Carp; require Symbol; -require utf8; -*utf8::is_utf8 = sub { # hack for perl 5.6 - require bytes; - return unless defined $_[0]; - return !(length($_[0]) == bytes::length($_[0])) -} unless defined &utf8::is_utf8; - $DBI::PurePerl = $ENV{DBI_PUREPERL} || 1; $DBI::PurePerl::VERSION = "2.014286"; diff --git a/t/80proxy.t b/t/80proxy.t index 3dd8f11e..33f3eb69 100644 --- a/t/80proxy.t +++ b/t/80proxy.t @@ -1,7 +1,6 @@ #!perl -w # -*- perl -*- # vim:sw=4:ts=8 -require 5.004; use strict;