![]() | |||||||||||||||||||||
|
CGI CGI has been the standard way of deploying web applications long before ASP came along. CGI.pm is a very useful module that aids developers in the building of these applications, and Apache::ASP has been made to be compatible with function calls in CGI.pm. Please see cgi.htm in the ./site/eg directory for a sample ASP script written almost entirely in CGI. As of version 0.09, use of CGI.pm for both input and output is seemless when working under Apache::ASP. Thus if you would like to port existing cgi scripts over to Apache::ASP, all you need to do is wrap <% %> around the script to get going. This functionality has been implemented so that developers may have the best of both worlds when building their web applications. Following are some special notes with respect to compatibility with CGI. Use of CGI.pm in any of these ways was made possible through a great amount of work, and is not gauranteed to be portable with other perl ASP implementations, as other ASP implementations will likely be more limited.
Query Object Initialization
You may create a CGI.pm $query object like so:
CGI headers
Not only can you use the CGI.pm $query->header() method
to put out headers, but with the CgiHeaders config option
set to true, you can also print "Header: value\n", and add
similar lines to the top of your script, like:
print()ing CGI
CGI is notorious for its print() statements, and the functions in CGI.pm
usually return strings to print(). You can do this under Apache::ASP,
since print just aliases to $Response->Write(). Note that $| has no
affect.
File Upload
CGI.pm is used for implementing reading the input from file upload. You
may create the file upload form however you wish, and then the
data may be recovered from the file upload by using $Request->Form().
Data from a file upload gets written to a filehandle, that may in
turn be read from. The original file name that was uploaded is the
name of the file handle.
|
||||||||||||||||||||
Copyright (c) 1998-1999, Joshua Chamas, Chamas Enterprises Inc. |