[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] CGI Glue (fwd)



According to Strider:
> 
> How is the information from a CGI form returned to the script? It was my
> understanding that it's saved in ARGV, but now that I have looked at the
> demo.acgi and demo.cgi scripts, ARGV isn't used anywhere, but $env is...
> how do I use that??
> 
> Do you send text back just by using the print command? What does the line
> -
> print <<END_FOOTER;
> -
> do?

Dependent upon whether it is a GET operation or a PUT
operation all of the returning information is either placed
into environment variables or the standard input (STDIN)
locations respectively.  The $ENV variable is the
environment variable.  So if you had named an input filed
MYINFO say, then $ENV{'MYINFO'} would return that
information.

Actually, it is better to use the

	$theReply = <<HTML_CODE;
Content-type:	text/html

<html>
<head>
<title>Title</title>
</head>

<body>
This is the body of the text.
</body>
</html>
HTML_CODE

	$theReply =~ s/\012/\012\015/g;
	&MacPerl::Reply( $theReply );
	exit( 0 );

Than the

	print <<HTML_CODE;
	.
	.
	.
HTML_CODE

Because on the Mac you have to change the return to a
carriage return - linefeed.  And you can not use the
standard PRINT command because the returning information is
going through an AppleScript program.

Question of my own:  Does the CGI.pm set of routines take
the Mac's way of having to respond into account?  If so,
then using CGI.pm would be the way to go.  :-)

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch