Apache-ASP

 view release on metacpan or  search on metacpan

site/objects.html  view on Meta::CPAN

If $key is not defined, the Value of the cookie is set.
ASP CookiePath is assumed to be / in these examples.
<font face="courier new" size=3><pre>
 $Response-&gt;Cookies(&#39;name&#39;, &#39;value&#39;); 
  --&gt; Set-Cookie: name=value; path=/

 $Response-&gt;Cookies(&quot;Test&quot;, &quot;data1&quot;, &quot;test value&quot;);     
 $Response-&gt;Cookies(&quot;Test&quot;, &quot;data2&quot;, &quot;more test&quot;);      
 $Response-&gt;Cookies(
	&quot;Test&quot;, &quot;Expires&quot;, 
	&amp;HTTP::Date::time2str(time+86400)
	); 
 $Response-&gt;Cookies(&quot;Test&quot;, &quot;Secure&quot;, 1);               
 $Response-&gt;Cookies(&quot;Test&quot;, &quot;Path&quot;, &quot;/&quot;);
 $Response-&gt;Cookies(&quot;Test&quot;, &quot;Domain&quot;, &quot;host.com&quot;);
  --&gt;	Set-Cookie:Test=data1=test%20value&amp;data2=more%20test;	\
 		expires=Fri, 23 Apr 1999 07:19:52 GMT;		\
 		path=/; domain=host.com; secure
</pre></font>The latter use of $key in the cookies not only sets cookie attributes
such as Expires, but also treats the cookie as a hash of key value pairs
which can later be accesses by
<font face="courier new" size=3><pre>
 $Request-&gt;Cookies(&#39;Test&#39;, &#39;data1&#39;);
 $Request-&gt;Cookies(&#39;Test&#39;, &#39;data2&#39;);
</pre></font>Because this is perl, you can (NOT PORTABLE) reference the cookies
directly through hash notation.  The same 5 commands above could be compressed to:
<font face="courier new" size=3><pre>
 $Response-&gt;{Cookies}{Test} = 
	{ 
		Secure	=&gt; 1, 
		Value	=&gt;	
			{
				data1 =&gt; &#39;test value&#39;, 
				data2 =&gt; &#39;more test&#39;
			},
		Expires	=&gt; 86400, # not portable, see above
		Domain	=&gt; &#39;host.com&#39;,
		Path    =&gt; &#39;/&#39;
	};
</pre></font>and the first command would be:
<font face="courier new" size=3><pre>
 # you don&#39;t need to use hash notation when you are only setting 
 # a simple value
 $Response-&gt;{Cookies}{&#39;Test Name&#39;} = &#39;Test Value&#39;; 
</pre></font>I prefer the hash notation for cookies, as this looks nice, and is 
quite perlish.  It is here to stay.  The Cookie() routine is 
very complex and does its best to allow access to the 
underlying hash structure of the data.  This is the best emulation 
I could write trying to match the Collections functionality of 
cookies in IIS ASP.
<font face="courier new" size=3><pre>
</pre></font>For more information on Cookies, please go to the source at
<a href=http://home.netscape.com/newsref/std/cookie_spec.html>http://home.netscape.com/newsref/std/cookie_spec.html</a></font>
	
	<p>
	<a name=%24Response-%3EDe321f073></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>$Response->Debug(@args)</b></font>
<font face="courier new" size=3><pre>
</pre></font>API Extension. If the Debug config option is set greater than 0, 
this routine will write @args out to server error log.  refs in @args 
will be expanded one level deep, so data in simple data structures
like one-level hash refs and array refs will be displayed.  CODE
refs like
<font face="courier new" size=3><pre>
 $Response-&gt;Debug(sub { &quot;some value&quot; });
</pre></font>will be executed and their output added to the debug output.
This extension allows the user to tie directly into the
debugging capabilities of this module.
<font face="courier new" size=3><pre>
</pre></font>While developing an app on a production server, it is often 
useful to have a separate error log for the application
to catch debugging output separately.  One way of implementing 
this is to use the Apache ErrorLog configuration directive to 
create a separate error log for a virtual host. 
<font face="courier new" size=3><pre>
</pre></font>If you want further debugging support, like stack traces
in your code, consider doing things like:
<font face="courier new" size=3><pre>
 $Response-&gt;Debug( sub { Carp::longmess(&#39;debug trace&#39;) };
 $SIG{__WARN__} = \&amp;Carp::cluck; # then warn() will stack trace
</pre></font>The only way at present to see exactly where in your script
an error occurred is to set the Debug config directive to 2,
and match the error line number to perl script generated
from your ASP script.  
<font face="courier new" size=3><pre>
</pre></font>However, as of version 0.10, the perl script generated from the 
asp script should match almost exactly line by line, except in 
cases of inlined includes, which add to the text of the original script, 
pod comments which are entirely yanked out, and &lt;% # comment %&gt; style
comments which have a \n added to them so they still work.
<font face="courier new" size=3><pre>
</pre></font>If you would like to see the HTML preceding an error 
while developing, consider setting the BufferingOn 
config directive to 0.</font>
	
	<p>
	<a name=%24Response-%3EE295b6523></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>$Response->End()</b></font>
<font face="courier new" size=3><pre>
</pre></font>Sends result to client, and immediately exits script.
Automatically called at end of script, if not already called.</font>
	
	<p>
	<a name=%24Response-%3EE0139cee1></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>$Response->ErrorDocument($code, $uri)</b></font>
<font face="courier new" size=3><pre>
</pre></font>API extension that allows for the modification the Apache
ErrorDocument at runtime.  $uri may be a on site document,
off site URL, or string containing the error message.  
<font face="courier new" size=3><pre>
</pre></font>This extension is useful if you want to have scripts
set error codes with $Response-&gt;{Status} like 401
for authentication failure, and to then control from
the script what the error message looks like.
<font face="courier new" size=3><pre>
</pre></font>For more information on the Apache ErrorDocument mechanism,
please see ErrorDocument in the CORE Apache settings,
and the Apache-&gt;custom_response() API, for which this method
is a wrapper.</font>
	
	<p>



( run in 0.439 second using v1.01-cache-2.11-cpan-5623c5533a1 )