Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: What's your favourite method of untainting?

by ysth (Canon)
on Dec 15, 2005 at 05:10 UTC ( [id://516862]=note: print w/replies, xml ) Need Help??


in reply to What's your favourite method of untainting?

$foo = each %{{$foo,0}}

Replies are listed 'Best First'.
Re^2: What's your favourite method of untainting?
by bliako (Monsignor) on Nov 09, 2023 at 17:56 UTC

    thanks for this. As it now issues the warning (perl v5.36.0):

    each on anonymous hash will always start from the beginning

    I propose this variation: ($foo) = keys %{{$foo,0}}

    Also, here is a test script using Test::Taint to check taintness:

    #!perl -T use strict; use warnings; use Test::More; use Test::Taint; my $foo = "ababab"; taint($foo); tainted_ok($foo, "foo is tainted"); ($foo) = keys %{{$foo,0}}; untainted_ok($foo, "foo is now untainted"); done_testing;

    bw, bliako

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-03-29 01:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found