Apache-ASP
view release on metacpan or search on metacpan
site/faq.html view on Meta::CPAN
as this:
<font face="courier new" size=3><pre>
<HTML><BODY>
$counter++;
$Response->Write("<BR>Counter: $counter");
</BODY></HTML>
</pre></font>The value for $counter++ will remain between requests.
Generally use of globals in this way is a BAD IDEA,
and you can spare yourself many headaches if do
"use strict" perl programming which forces you to
explicity declare globals like:
<font face="courier new" size=3><pre>
use vars qw($counter);
</pre></font>You can make all your Apache::ASP scripts strict by
default by setting:
<font face="courier new" size=3><pre>
PerlSetVar UseStrict 1
</pre></font>
<p>
<a name=Apache%20errorf0bcd572></a>
<font face=verdana><font class=title size=-1 color=#555555><b>Apache errors on the PerlHandler or PerlModule directives ?</b></font>
<font face="courier new" size=3><pre>
</pre></font>You get an error message like this:
<font face="courier new" size=3><pre>
Invalid command 'PerlModule', perhaps mis-spelled or defined by a
module not included in the server configuration.
</pre></font>You do not have <a href=http://perl.apache.org><font size=-1 face=verdana><b>mod_perl</b></font></a> correctly installed for Apache. The PerlHandler
and PerlModule directives in Apache *.conf files are extensions enabled by mod_perl
and will not work if mod_perl is not correctly installed.
<font face="courier new" size=3><pre>
</pre></font>Common user errors are not doing a 'make install' for mod_perl, which
installs the perl side of mod_perl, and not starting the right httpd
after building it. The latter often occurs when you have an old apache
server without mod_perl, and you have built a new one without copying
over to its proper location.
<font face="courier new" size=3><pre>
</pre></font>To get mod_perl, go to <a href=http://perl.apache.org>http://perl.apache.org</a></font>
<p>
<a name=Error%3A%20no%20reb1d13fcf></a>
<font face=verdana><font class=title size=-1 color=#555555><b>Error: no request object (Apache=SCALAR(0x???????):)</b></font>
<font face="courier new" size=3><pre>
</pre></font>Your Apache + <a href=http://perl.apache.org><font size=-1 face=verdana><b>mod_perl</b></font></a> build is not working properly,
and is likely a RedHat Linux RPM DSO build. Make sure
you statically build your Apache + mod_perl httpd,
recompiled fresh from the sources.</font>
<p>
<a name=I%20am%20getting272ca0df></a>
<font face=verdana><font class=title size=-1 color=#555555><b>I am getting a tie or MLDBM / state error message, what do I do?</b></font>
<font face="courier new" size=3><pre>
</pre></font>Make sure the web server or you have write access to the eg directory,
or to the directory specified as Global in the config you are using.
Default for Global is the directory the script is in (e.g. '.'), but should
be set to some directory not under the www server document root,
for security reasons, on a production site.
<font face="courier new" size=3><pre>
</pre></font>Usually a
<font face="courier new" size=3><pre>
chmod -R -0777 eg
</pre></font>will take care of the write access issue for initial testing purposes.
<font face="courier new" size=3><pre>
</pre></font>Failing write access being the problem, try upgrading your version
of Data::Dumper and MLDBM, which are the modules used to write the
state files.</font>
<p>
<a name=Sessions></a>
<font face=verdana><font class=title size=+0 color=#555555><b>Sessions</b></font>
</font>
<p>
<a name=How%20can%20I%20us65e9eed9></a>
<font face=verdana><font class=title size=-1 color=#555555><b>How can I use $Session to store complex data structures.</b></font>
<font face="courier new" size=3><pre>
</pre></font>Very carefully. Please read the $Session documentation in
the <a href=objects.html><font size=-1 face=verdana><b>OBJECTS</b></font></a> section. You can store very complex objects
in $Session, but you have to understand the limits, and
the syntax that must be used to make this happen.
<font face="courier new" size=3><pre>
</pre></font>In particular, stay away from statements that that have
more than one level of indirection on the left side of
an assignment like:
<font face="courier new" size=3><pre>
BAD: $Session->{complex}{object} = $data;
</pre></font>
<p>
<a name=How%20can%20I%20ke601a6c31></a>
<font face=verdana><font class=title size=-1 color=#555555><b>How can I keep search engine spiders from killing the session manager?</b></font>
<font face="courier new" size=3><pre>
</pre></font>If you want to disallow session creation for certain non web
browser user agents, like search engine spiders, you can use a <a href=http://perl.apache.org><font size=-1 face=verdana><b>mod_perl</b></font></a>
PerlInitHandler like this to set configuration variables at runtime:
<font face="courier new" size=3><pre>
# put the following code into httpd.conf and stop/start apache server
PerlInitHandler My::InitHandler
<Perl>
package My::InitHandler;
use Apache;
sub handler {
my $r = shift; # get the Apache request object
# if not a Mozilla User Agent, then disable sessions explicitly
unless($r->headers_in('User-Agent') =~ /^Mozilla/) {
$r->dir_config('AllowSessionState', 'Off');
}
return 200; # return OK mod_perl status code
}
1;
</Perl>
</pre></font>This will configure your environment before Apache::ASP executes
and sees the configuration settings. You can use the mod_perl
API in this way to configure Apache::ASP at runtime.
( run in 1.618 second using v1.01-cache-2.11-cpan-39bf76dae61 )