Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^3: How a web server sending data to a CGI perl script ?

by flexvault (Monsignor)
on Jan 25, 2016 at 16:03 UTC ( #1153585=note: print w/replies, xml ) Need Help??

in reply to Re^2: How a web server sending data to a CGI perl script ?
in thread How a web server sending data to a CGI perl script ?

Hello exilepanda,

If you do it the way I described, the %ENV variables are already set-up for you. Do not touch the %ENV, but copy the %ENV to a temp hash. And remember you still need the GET / POST data ( the actual $Todo work ) from the WebServer. ( Example ).

my $Todo = ...; # Data sent via GET or POST from browser via We +bServer my $environment = ''; foreach my $env ( keys %ENV ) { $environment .= "$env\t$ENV{$env}\n"; } my $send = pack("N",length($environment) ) . $environment . pack( +"N",length($Todo) ) . $Todo; my $ret = send_data( $svr, \$send ); # Send to processing Perl s +cript
Now the second client has the environment of the WebSever, and it's own %ENV from Perl. The processing client uses %TempENV for WebServer info and it's own %ENV if it needs it.

It's clean and you don't have to get into the error handling of the WebServer.

Good Luck!


"Well done is better than well said." - Benjamin Franklin

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2022-01-19 15:02 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (55 votes). Check out past polls.