in reply to Two questions about CGI and format specifiers (was: Two questions)

1. There is no reason that you shouldn't be able to read what you just wrote to the file. That is, assuming you are manipulating the file correctly. Be sure to close any files you open. For a better answer we need to see the code.

2. To print to STOUT for the browser to get it through CGI you need to first print the HTTP headers:

print "Content-type: text/html\n\n";
Then print anything you want the browser to see:
print $stuff;
For details on using format() consult the Perl core docs.

-caedes

Replies are listed 'Best First'.
Re: Re: Two questions
by whiteperl (Scribe) on Jun 30, 2002 at 09:01 UTC

    Thanks for editing my text - whoever it was :) - I gotta brush up on my html.

    So to print the format to STDOUT

    I rename the format STDOUT like:

    print "Content-type: text/html\n\n"; $name1 = 'whiteperl'; $name2 = 'batman'; format STDOUT = @<<<<<<< @<<<<<<<< $name1 $name2 . $~ = STDOUT; # Is this necessary? print STDOUT;

    Will this work? Tripod CGI is very restrictive. I don't think that I have ever gotten a select() to work, so I use $~.

    In the above, STDOUT isn't associated with a file handle. That's why I'm not too sure. But I'll go and see.

      You should check out Site How To to see about formating your posts here. As for format(), I can't say much because I've never used it, but print STDOUT; is most definitely wrong. :-)

      -caedes