in reply to Checking to see if Taint mode is enabled

The contents of your current directory are tainted (when I tried it, at least).

sub is_tainted { return ! eval { eval("#" . substr(join("", @_), 0, 0)); 1 }; } opendir my $dot_fh, '.' or die "Can't opendir .: $!"; my ($any_file) = readdir $dot_fh; closedir $dot_fh; print "tainted\n" if is_tainted( $any_file );

Replies are listed 'Best First'.
Re^2: Checking to see if Taint mode is enabled
by Anno (Deacon) on Mar 17, 2007 at 16:20 UTC
    sub is_tainted { return ! eval { eval("#" . substr(join("", @_), 0, 0)); 1 }; }
    Ingenious, but unnecessary. There's Scalar::Util::tainted.

    Anno