Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Checking to see if Taint mode is enabled

by ferreira (Chaplain)
on Mar 17, 2007 at 18:00 UTC ( #605288=note: print w/replies, xml ) Need Help??


in reply to Checking to see if Taint mode is enabled

Is there a better way to check for taintedness of a variable, say with a CPAN module (or some internal Perl thing I can check if I create my own XS module)?

The immediate solution that comes to my mind is to use Scalar::Util which belongs to core since 5.7.3 and its tainted function. From the module's documentation:

=item tainted EXPR Return true if the result of EXPR is tainted $taint = tainted("constant"); # false $taint = tainted($ENV{PWD}); # true if running under -T

You may learn more about in the sections of perlsec devoted to tainting. You will find there the expression mentioned by Anno at Re^2: Checking to see if Taint mode is enabled and the recommendation for Scalar::Util::tainted (also mentioned in the same node) if you're using 5.8.0 or later.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://605288]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2019-10-15 12:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?