Detecting taint mode

dakkar dakkar at
Sun Feb 25 20:58:19 GMT 2007

David Cantrell wrote:
> Anyone got a nifty way of detecting whether you're running in taint-mode
> which doesn't rely on ${^TAINT}?  Cos that magic variable ain't
> available in 5.6.2.

Might be ugly, but:

 my $x=eval {system "/bin/true"};
 print "Taint!\n" if $@;

seems to work. In other words, an easy way is to trigger the taint check
inside an 'eval', and see if it died.

	Dakkar - <Mobilis in mobile>
	GPG public key fingerprint = A071 E618 DD2C 5901 9574
	                             6FE2 40EA 9883 7519 3F88
	                    key id = 0x75193F88

More information about the mailing list