OK, here is the working solution:

package TestCommon::Utils;

use strict;
use warnings FATAL => 'all';

BEGIN {
    # perl 5.8.0 can't run eval {} block when it thinks the
    # application is setgid, that's why we need to shutdown compile
    # time errors for this function
    local $SIG{__DIE__} = sub { };

    sub is_tainted {
        return ! eval { eval join '', map { substr $_, 0, 0 } @_; 1 };
    }
}

1;

Notice that I've also further optimized the original:

  return ! eval { eval "#" . substr join('', @_), 0, 0; 1 };

to pick not do the temporary join since @_ may include very long strings, why wasting time to allocate memory for it.

--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to