Home: Perl Programming Help: Regular Expressions:
STDIN & STDOUT



Pro_4
User

Apr 24, 2001, 2:00 PM


Views: 7519
STDIN & STDOUT

I read in a perl book that stdin and stdout take in information that is input through the keyboard. I understand the concept for using it on your computer programs but how about web applications? Is STDIN and STDOUT used in cgi programs on sites?

Always add fun to Perl
$fun = "fun"; $perl = "Perl";
print " Always add $fun to $perl"; die;


Jean
User


Apr 24, 2001, 11:02 PM


Views: 7516
Re: STDIN & STDOUT

My guess is that STDIN and STDOUT are not applicable in other than console applications,
though you can always redirect them, say, to a file and continue to use them even in cgi.

Jean Spector
QA Engineer @ Extent Technologies, Ltd.
mage@lycosmail.com


Pro_4
User

Apr 25, 2001, 11:58 AM


Views: 7512
Re: STDIN & STDOUT

OK thats what it thought. Thanks for the info.

:)

Always add fun to Perl
$fun = "fun"; $perl = "Perl";
print " Always add $fun to $perl"; die;


japhy
Enthusiast / Moderator

Apr 25, 2001, 3:42 PM


Views: 7510
Re: STDIN & STDOUT

Where do you think you get POST query data from? Where do you think you print to?

Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author


Pro_4
User

Apr 26, 2001, 1:52 PM


Views: 7506
Re: STDIN & STDOUT

Well.. that is why i asked the question.. so i could find out what it did do.

:)

Always add fun to Perl
$fun = "fun"; $perl = "Perl";
print " Always add $fun to $perl"; die;


Jean
User


Apr 28, 2001, 11:20 PM


Views: 7494
Re: STDIN & STDOUT

Sorry for misguiding you.
I shouldn't have answered in the first place as I'm not familiar with CGI at all.
The only "good" thing in my post is the word guess and that's what my aswer was - a guess :-(

Jean Spector
QA Engineer @ Extent Technologies, Ltd.
mage@lycosmail.com


Pro_4
User

Apr 29, 2001, 6:24 AM


Views: 7493
Re: STDIN & STDOUT

It's not a problem. Atleast you attempted to answer my question.

People Engrossed by a Reliable Language


localfilmmaker
stranger

May 8, 2001, 11:26 AM


Views: 7465
Re: STDIN & STDOUT

STDIN, STDOUT, and STDERR are all used in CGI scripts as well as console programs. With CGI scripts, the web server that executes your CGI scripts will send all CGI params to you script's STDIN for it to read. And then it will get all output from the script's STDOUT and return it as the response to the browser. Depending on the web server, any errors or warnings printed to STDERR will either get printed with your STDOUT as part of the response, or it will be ignored or logged in a log file. That's how it usually works.

-localfilmmaker
Spencer Christensen
spencer@mecworks.com