Apache :: ASP
Web applications with Apache + mod_perl
  INTRO
  DOWNLOAD
  CONFIG
  SYNTAX
  EVENTS
  OBJECTS
  SSI
  SESSIONS
  XML/XSLT
  CGI
  PERLSCRIPT
% FAQ
  TUNING
  CREDITS
  SUPPORT
  SITES USING
  RESOURCES
  TODO
  CHANGES
  LICENSE

  EXAMPLES

Powered by Apache::ASP
Powered by ModPerl and Apache
Links Checked by NodeWorks
FAQ

The following are some frequently asked questions
about Apache::ASP.

Installation How is database connectivity handled?
Apache errors on the PerlHandler directive ? What is the best way to debug an ASP application ?
Error: no request object (Apache=SCALAR(0x???????):) How are file uploads handled?
I am getting a tie or MLDBM / state error message, what do I do? How do I access the ASP Objects in general?
Can I print() in ASP?
Sessions Do I have access to ActiveX objects?
How can I use $Session to store complex data structures. Can I script in VBScript or JScript ?
How can I keep search engine spiders from killing the session manager?
Insecure dependency in eval while running with - T switch ? Support and Production
How can I use $Session to store a $dbh database handle ? How do I get things I want done?!
What is the state of Apache::ASP? Can I publish a web site on it?
Development  

Installation

Apache errors on the PerlHandler directive ?

You do not have mod_perl correctly installed for Apache.  The PerlHandler
directive in Apache *.conf files is an extension enabled by mod_perl
and will not work if mod_perl is not correctly installed.
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.
To get mod_perl, go to http://perl.apache.org

Error: no request object (Apache=SCALAR(0x???????):)

Your Apache + mod_perl 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.
	
	

I am getting a tie or MLDBM / state error message, what do I do?

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.
Usually a
 chmod -R -0777 eg
will take care of the write access issue for initial testing purposes.
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.

Sessions

How can I use $Session to store complex data structures.

Very carefully.  Please read the $Session documentation in
the OBJECTS 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.
In particular, stay away from statements that that have more than one level of indirection on the left side of an assignment like:
  $Session->{complex}{object} = $data; 

How can I keep search engine spiders from killing the session manager?

If you want to dissallow session creation for certain non web
browser user agents, like search engine spiders, you can use an
init handler like:
  PerlInitHandler "sub { $_[0]->dir_config('NoState', 1) }"
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.

Insecure dependency in eval while running with - T switch ?

If you are running your mod_perl with "PerlTaintCheck On", which
is recommended if you are highly concerned about security issues,
you may get errors like "Insecure dependency ... with - T switch".
Apache::ASP automatically untaints data internally so that you may run scripts with PerlTaintCheck On, but if you are using state objects like $Session or $Application, you must also notify MLDBM, which Apache::ASP uses internally, to also untaint data read from disk, with this setting:
  $MLDBM::RemoveTaint = 1;
You could put the above line in your global.asa, which is just like a perl module, outside any event handlers you define there.

How can I use $Session to store a $dbh database handle ?

You cannot use $Session to store a $dbh handle.  This can
be awkward for those coming from the IIS/NT world, where
you could store just about anything in $Session, but this
boils down to a difference between threads vs. processes.
Database handles often have per process file handles open, which cannot be shared between requests, so though you have stored the $dbh data in $Session, all the other initializations are not relevant in another httpd process.
All is not lost! Apache::DBI can be used to cache database connections on a per process basis, and will work for most cases.

Development

How is database connectivity handled?

Database connectivity is handled through perl's DBI & DBD interfaces.
Please see http://www.symbolstone.org/technology/perl/DBI/ for more information.
In the UNIX world, it seems most databases have cross platform support in perl.
DBD::ODBC is often your ticket on Win32. On UNIX, commercial vendors like OpenLink Software (http://www.openlinksw.com/) provide the nuts and bolts for ODBC.
Database connections can be cached per process with Apache::DBI.

What is the best way to debug an ASP application ?

There are lots of perl-ish tricks to make your life developing
and debugging an ASP application easier.  For starters,
you will find some helpful hints by reading the
$Response->Debug() API extension, and the Debug
configuration directive.
	
	

How are file uploads handled?

Please see the CGI section.  File uploads are implemented
through CGI.pm which is loaded at runtime only for this purpose.
This is the only time that CGI.pm will be loaded by Apache::ASP,
which implements all other cgi-ish functionality natively.  The
rationale for not implementing file uploads natively is that
the extra 100K in memory for CGI.pm shouldn't be a big deal if you
are working with bulky file uploads.
	
	

How do I access the ASP Objects in general?

All the ASP objects can be referenced through the main package with
the following notation:
 $main::Response->Write("html output");
This notation can be used from anywhere in perl, including routines registered with $Server->RegisterCleanup().
You use the normal notation in your scripts, includes, and global.asa:
 $Response->Write("html output"); 

Can I print() in ASP?

Yes.  You can print() from anywhere in an ASP script as it aliases
to the $Response->Write() method.  Using print() is portable with
PerlScript when using Win32::ASP in that environment.
	
	

Do I have access to ActiveX objects?

Only under Win32 will developers have access to ActiveX objects through
the perl Win32::OLE interface.  This will remain true until there
are free COM ports to the UNIX world.  At this time, there is no ActiveX
for the UNIX world.
	
	

Can I script in VBScript or JScript ?

Yes, but not with this perl module.  For ASP with other scripting
languages besides perl, you will need to go with a commercial vendor
in the UNIX world.  ChiliSoft at http://www.chilisoft.com/ has one
such solution.  Of course on NT, you get this for free with IIS.
	
	

Support and Production

How do I get things I want done?!

If you find a problem with the module, or would like a feature added,
please mail support, as listed in the SUPPORT section, and your
needs will be promptly and seriously considered, then implemented.
	
	

What is the state of Apache::ASP? Can I publish a web site on it?

Apache::ASP has been production ready since v.02.  Work being done
on the module is on a per need basis, with the goal being to eventually
have the ASP API completed, with full portability to ActiveState PerlScript
and MKS PScript.  If you can suggest any changes to facilitate these
goals, your comments are welcome.
	

Copyright © 1998-2000, Joshua Chamas, Chamas Enterprises Inc.