Subject: | [PATCH] Avoid using ancient Taint module and use Scalar::Util instead |
I am assuming the requirement on the Taint module is back before the
Scalar::Util module existed. Taint does not pass its tests for me and I
don't see the reason to use it at all when it is replaced by
Scalar::Util, a module included with modern versions of perl. I use this
patch when packaging Debug-ShowStuff and I provide it here for others.
Subject: | scalar-util.patch |
diff -ur Debug-ShowStuff-1.11/Makefile.PL Debug-ShowStuff-1.11-patched//Makefile.PL
--- Debug-ShowStuff-1.11/Makefile.PL 2010-11-22 14:47:36.000000000 -0800
+++ Debug-ShowStuff-1.11-patched//Makefile.PL 2010-11-22 15:06:03.000000000 -0800
@@ -6,7 +6,7 @@
'VERSION_FROM' => "ShowStuff.pm", # finds $VERSION
'PREREQ_PM' => {
'Tie::IxHash' => 1.1,
- 'Taint' => 0.09,
+ 'Scalar::Util' => 0,
'MemHandle' => 0.06,
}, # e.g., Module::Name => 1.1
diff -ur Debug-ShowStuff-1.11/ShowStuff.pm Debug-ShowStuff-1.11-patched//ShowStuff.pm
--- Debug-ShowStuff-1.11/ShowStuff.pm 2010-11-22 14:47:36.000000000 -0800
+++ Debug-ShowStuff-1.11-patched//ShowStuff.pm 2010-11-22 14:49:05.000000000 -0800
@@ -2037,7 +2037,7 @@
sub showtainted {
my (@vals) = @_;
- require Taint;
+ require Scalar::Util;
# if first value is a hashref, show as hash
if (UNIVERSAL::isa $vals[0], 'HASH') {
@@ -2047,7 +2047,7 @@
while ( my($key, $val) = each(%$hashref) ) {
my ($tainted);
- if (Taint::tainted($val))
+ if (Scalar::Util::tainted($val))
{ $tainted = 'tainted' }
else
{ $tainted = 'not tainted' }
@@ -2063,7 +2063,7 @@
foreach my $val (@vals) {
my ($tainted);
- if (Taint::tainted($val))
+ if (Scalar::Util::tainted($val))
{ $tainted = 'tainted: ' }
else
{ $tainted = 'not tainted: ' }