stas 2004/11/01 15:31:02
Modified: t/lib/TestCommon Utils.pm Log: - more efficient version of is_tainted (no data allocated) - apparently the workaround for the problem with eval {} with perl5.8.0/setgid can be replaced with 'use warnings FATAL => 'all';' Revision Changes Path 1.6 +11 -12 modperl-2.0/t/lib/TestCommon/Utils.pm Index: Utils.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/lib/TestCommon/Utils.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- Utils.pm 19 Oct 2004 02:48:39 -0000 1.5 +++ Utils.pm 1 Nov 2004 23:31:02 -0000 1.6 @@ -3,16 +3,14 @@ use strict; use warnings FATAL => 'all'; -BEGIN { - # perl 5.8.0 (only) croaks on eval {} block at compile time when - # it thinks the application is setgid. workaround: shutdown - # compile time errors for this function - local $SIG{__DIE__} = sub { }; - # perl 5.6.x only triggers taint protection on strings which are - # at least one char long - sub is_tainted { - return ! eval { eval join '', '#', map substr($_, 0, 0), @_; 1}; - } +# perl 5.6.x only triggers taint protection on strings which are at +# least one char long +sub is_tainted { + return ! eval { + eval join '', '#', + map defined() ? substr($_, 0, 0) : (), @_; + 1; + }; } 1; @@ -49,9 +47,10 @@ =head2 is_tainted() - is_tainted($data) + is_tainted(@data); -returns I<TRUE> if C<$data> is tainted, I<FALSE> otherwise +returns I<TRUE> if at least one element in C<@data> is tainted, +I<FALSE> otherwise.