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;
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.