Why not adopt me?
Apache::HTPL - Apache mod_perl driver for HTPL.
After installed, this module will boost the performance of HTPL by having pages compiled in memory and run again and again. It utilizes the Apache mod_perl extension, and can't be otherwise used.
The HTPL page translator is compiled into this module as an XSUB extension. (I could not execute the page translator as a child process - any advices?)
The easiest way to install HTPL under mod_perl is to ask for it when running the configure script:
Suppose installation was done as root (which is highly recommended), configuration file will be initialized.
Otherwise, add the following lines to httpd.conf:
<Files ~ "*.htpl"> SetHandler perl-script PerlHandler Apache::HTPL </Files>
- Local variables
Apache::HTPL works similarly to Apache::Registry - it creates a namespace and a subroutine for every page. It will attempt to clear the namespace between page calls, to allow "dirty" scripting by assuming empty variables. It does so by consulting the stash of a package.
- Global variables
Consistent value can be stored on different namespaces - recommended is Apache::HTPL::Vars or the alike. Do not use it for stateful sessions, as Apache spawns several processes on a server. Use the internal persistent objects to keep stateful sessions, via the %application and %session hashes. Global variables can be used to initialized tables, for example.
- Persistent database connections
The Database module will cache database connections and reuse them. Since this uses up one database connection per Apache process, you can disable this feature by editing you configuration file and changing the value of $htpl_db_save.
The htpl-config.pl file will still be stored on the cgi-bin directory while using HTPL on mod_perl mode, as will be the htpldbg page translator. The installation will always create htpl.cgi.
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 210:
'=item' outside of any '=over'
- Around line 232:
You forgot a '=back' before '=head1'