in reply to Re^2: What filehandle should be used for HTML prints via CGI??
in thread What filehandle should be used for HTML prints via CGI??

Erm, "output to command line" . . . where to start.

STDOUT is, as the name would imply, the, erm, standard output filehandle. Processes get 3 handles: STDIN, STDOUT, and STDERR. What those actually are hooked up to depends on how whatever forks the process hooks them up to. In the interactive case where you're running something from a shell, they'll all usually be hooked up to a TTY device of some sort. When run as a CGI, the webserver will provide a STDOUT which goes back (after some processing in most cases) to the browser making the request.

In Perl the default filehandle for print will be STDOUT unless you use select (or reopen STDOUT somewhere else). Any output to that handle will go to whatever that file descriptor's hooked to.

  • Comment on Re^3: What filehandle should be used for HTML prints via CGI??

Replies are listed 'Best First'.
Re^4: What filehandle should be used for HTML prints via CGI??
by virtualsue (Vicar) on Jan 12, 2007 at 20:08 UTC
    You mixed a genuinely helpful reply with a heaping helping of derision, for what reason I'm not really certain. "Erm ... where to start." seems to indicate that you believe you are addressing a gibbering monkey instead of somebody politely asking a question about something that puzzled him.

      Given the quality of this and some other recent questions, I'm not sure that any simian speculations wouldn't be an entirely plausible presumption.

      And, as evidenced above, I'm not the only person who found the, shall we say, interesting melange of technobabble terms indicative of a, again shall we say, less than complete grasp of the concepts at hand.

      You're of course more than welcome to avail yourself of the handy -- button. And the OP is more than welcome to a full and complete refund of his Perl Monks support fee.

Re^4: What filehandle should be used for HTML prints via CGI??
by Jenda (Abbot) on Jan 12, 2007 at 23:15 UTC

    fork? That's not how processes happen to come to life in Windows (at least most of the time, the perl fork() builtin included!) which is in all likelihood what PockMonk uses. In either case even under Windows is is the process that starts another process who decides where do the STDOUT, STDERR and STDIN point to (if anywhere at all). In case of a process started by the cmd.exe (the "command line" or "command prompt" or "shell" (for the unix folk)) then the STDOUT and STDERR point to whereever cmd.exe needs them to to display them in its window. In case of CGI scripts, they point to whereever the web server needs them to point to so that it can process the stuff a bit and forward it to the browser.

    Though definitely no fork()s and no TTYs are involved. The whole world doesn't run Unix Fletch.

A reply falls below the community's threshold of quality. You may see it by logging in.