Peter R. Wiley wrote: >I have set up MacHTTP to test CGI scripts offline (via a "fake" >connection).[snip] >The thing is that said script does not print to my browser via MacHTTP >properly. I assume that the problem is the attempt to print to STDOUT. >MacHTTP documentation seems to be silent on this point. > >Can someone enlighten me as to how to fix the problem? It does not seem to >be as simple as just changing: > > print *STDOUT $line; > >to > > print $line; > I'd say just try that. Disclaimer/ignorance paragraph: I don't much about MacHTTP. STDOUT is implicit in print statements, and I don't think you need the '*' (in fact, I don't have time to look this up right now, but what _does_ *STDOUT do? Filehandles can be referenced with '*', but I'm not clear why one might want a ref to STDOUT). Anyway, the standard way to output from CGIs is like this: 1. First, print an http header (at least a partial one) providing MIME type. This MUST precede all other print statements providing output in an http context. So if your script has conditional statements, loops, etc., make sure this prints before any part of your script might output something. The header must be followed by a blank line, so this is usually done with "\n\n", but that depends on how you're quoting your output. Some MIME type header statements: Content-type: text/html Content-type: text/plain Content-type: image/gif To print your output for a web page: print "Content-type: text/html\n\n" ; # Must have 2 line breaks print "$line\n" ; [etc.] Note that you can print to more than one place during a single routine. Let's say you have a file open with the filehandle FH (e.g., from open FH, "$filename" ...), then you can output to both http and the file: [assumes you've already opened file and output Content-type header] [whatever] { [processing] print FH "$line\n" ; # prints to file print "$line\n" ; # prints CGI output } As far as I know, the MIME header doesn't affect anything regarding printing to file, but others may enlighten... Good luck! 1: - Bruce _Bruce_Van_Allen___bva@cruzio.com__831_429_1688_V_ _PO_Box_839__Santa_Cruz_CA__95061__831_426_2474_W_ ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org