Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Populate CGI from HTTP::Request wo/ using %ENV ?

by ikegami (Pope)
on Mar 09, 2008 at 22:33 UTC ( #673142=note: print w/ replies, xml ) Need Help??


in reply to Re: Populate CGI from HTTP::Request wo/ using %ENV ?
in thread Populate CGI from HTTP::Request wo/ using %ENV ?

local %ENV doesn't remove the magic attached to %ENV, so changes to %ENV still affect every thread, so the race condition remains.

THREAD 1 THREAD 2 ---------------------------------- ------------------------------ +---- { T local %ENV; i -> Process's R_M remains undef m $ENV{REQUEST_METHOD} = 'GET'; e -> Process's R_M becomes GET | | { | local %ENV; v -> Process's R_M becomes undef $ENV{REQUEST_METHOD} = 'PUT'; -> Process's R_M becomes PUT print($ENV{REQUEST_METHOD}); -> Prints process's R_M (PUT) } -> Process's R_M restored to undef print($ENV{REQUEST_METHOD}); -> Prints process's R_M (undef +) } -> Process's R_M restored to u +ndef

That's why I suggested local *ENV instead. Then modifying %ENV doesn't change the processes environment.

Update: Added illustration of two race conditions.


Comment on Re^2: Populate CGI from HTTP::Request wo/ using %ENV ?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-12-28 11:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (180 votes), past polls