Apache-ASP

 view release on metacpan or  search on metacpan

site/cgi.html  view on Meta::CPAN

	
		<tr>
		
			<td valign=top >
			<font face="lucida console" size=-1>
			<a href=#Standalone%20Cbddd74cc>Standalone CGI Mode, without mod_perl</a>
			</font>
			</td>
		
			<td valign=top >
			<font face="lucida console" size=-1>
			<a href=#CGI%20headers>CGI headers</a>
			</font>
			</td>
							
		</tr>
		
		<tr>
		
			<td valign=top >
			<font face="lucida console" size=-1>
			<a href=#CGI.pm>CGI.pm</a>
			</font>
			</td>
		
			<td valign=top >
			<font face="lucida console" size=-1>
			<a href=#print%28%29ing%20C99232b52>print()ing CGI</a>
			</font>
			</td>
							
		</tr>
		
		<tr>
		
			<td valign=top >
			<font face="lucida console" size=-1>
			<a href=#Query%20Object4fef5875>Query Object Initialization</a>
			</font>
			</td>
		
			<td valign=top >
			<font face="lucida console" size=-1>
			<a href=#File%20Upload>File Upload</a>
			</font>
			</td>
							
		</tr>
			
	</table>
	<hr size=1>
	<p>

	<p>
	<a name=Standalone%20Cbddd74cc></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>Standalone CGI Mode, without mod_perl</b></font>
<font face="courier new" size=3><pre>
</pre></font>As of version 2.19, Apache::ASP scripts may be run as standalone
<a href=cgi.html><font size=-1 face=verdana><b>CGI</b></font></a> scripts without mod_perl being loaded into Apache.  Work
to date has only been done with mod_cgi scripts under Apache on a
Unix platform, and it is unlikely to work under other web servers 
or Win32 operating systems without further development.
<font face="courier new" size=3><pre>
</pre></font>To run the ./site/eg scripts as CGI scripts, you copy the 
./site directory to some location accessible by your web
server, in this example its /usr/local/apache/htdocs/aspcgi, 
then in your httpd.conf activate Apache::ASP cgi
scripts like so:
<font face="courier new" size=3><pre>
 Alias /aspcgi/ /usr/local/apache/htdocs/aspcgi/
 &lt;Directory /usr/local/apache/htdocs/aspcgi/eg/ &gt;
   AddType application/x-httpd-cgi .htm
   AddType application/x-httpd-cgi .html
   AddType application/x-httpd-cgi .asp
   AddType application/x-httpd-cgi .xml
   AddType application/x-httpd-cgi .ssi
   AllowOverride None
   Options +ExecCGI +Indexes
 &lt;/Directory&gt;
</pre></font>Then install the asp-perl script from the distribution 
into /usr/bin, or some other directory.  This is 
so the CGI execution line at the top of those scripts
will invoke the asp-perl wrapper like so:
<font face="courier new" size=3><pre>
 #!/usr/bin/perl /usr/bin/asp-perl
</pre></font>The asp-perl script is a cgi wrapper that sets up the 
Apache::ASP environment in lieu of the normal mod_perl
handler request.  Because there is no Apache-&gt;dir_config()
data available under mod_cgi, the asp-perl script will load
a asp.conf file that may define a hash %Config of
data for populating the dir_config() data.  An example
of a complex asp.conf file is at <a href=eg/asp.conf>./site/eg/asp.conf</a>
<font face="courier new" size=3><pre>
</pre></font>So, a trivial asp.conf file might look like:
<font face="courier new" size=3><pre>
 # asp.conf
 %Config = (
   &#39;Global&#39; =&gt; &#39;.&#39;,
   &#39;StateDir&#39; =&gt; &#39;/tmp/aspstate&#39;,
   &#39;NoState&#39; =&gt; 0,
   &#39;Debug&#39; =&gt; 3,
 );
</pre></font>The default for NoState is 1 in CGI mode, so one must
set NoState to 0 for objects like $Session &amp; $Application
to be defined.</font>
	
	<p>
	<a name=CGI.pm></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>CGI.pm</b></font>
<font face="courier new" size=3><pre>
</pre></font>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 <a href=cgi.html><font size=-1 face=verdana><b>CGI</b></font></a>.
<font face="courier new" size=3><pre>
</pre></font>As of version 0.09, use of CGI.pm for both input and output is seamless
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 &lt;% %&gt; 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.



( run in 0.664 second using v1.01-cache-2.11-cpan-39bf76dae61 )