|
SSI
SSI is great! One of the main features of server side includes
is to include other files in the script being requested. In Apache::ASP,
this is implemented in a couple ways, the most crucial of which
is implemented in the file include. Formatted as
<!--#include file=filename.inc-->
,the .inc being merely a convention, text from the included
file will be inserted directly into the script being executed
and the script will be compiled as a whole. Whenever the
script or any of its includes change, the script will be
recompiled.
Includes go a great length to promote good decomposition
and code sharing in ASP scripts, but they are still
fairly static. As of version .09, includes may have dynamic
runtime execution, as subroutines compiled into the global.asa
namespace. The first way to invoke includes dynamically is
<!--#include file=filename.inc args=@args-->
If @args is specified, Apache::ASP knows to execute the
include at runtime instead of inlining it directly into
the compiled code of the script. It does this by
compiling the script at runtime as a subroutine, and
caching it for future invocations. Then the compiled
subroutine is executed and has @args passed into its
as arguments.
This is still might be too static for some, as @args
is still hardcoded into the ASP script, so finally,
one may execute an include at runtime by utilizing
this API extension
$Response->Include("filename.inc", @args);
which is a direct translation of the dynamic include above.
Although inline includes should be a little faster,
runtime dynamic includes represent great potential
savings in httpd memory, as includes are shared
between scripts keeping the size of each script
to a minimum. This can often be significant saving
if much of the formatting occurs in an included
header of a www page.
By default, all includes will be inlined unless
called with an args parameter. However, if you
want all your includes to be compiled as subs and
dynamically executed at runtime, turn the DynamicIncludes
config option on as documented above.
Apache::SSI for mod_perl 1.3.x only
One of the things missing above is the
<!--#include virtual=filename.cgi-->
tag. This and many other SSI code extensions are available
by filtering Apache::ASP output through Apache::SSI via
the Apache::Filter and the Filter config options, available in mod_perl 1.3.x / Apache 1.3.x.
Unfortunately this functionality is not available with mod_perl 2 / Apache 2.
For more information on how to wire Apache::ASP and Apache::SSI
together, please see the Filter config option documented
above. Also please see Apache::SSI for further information
on the capabilities it offers.
SSI with mod_filter in Apache 2
Apache 2 offers chained filters. It may be possible to chain filters to
Apache::ASP output through mod_filter for SSI processing:
http://httpd.apache.org/docs/2.1/mod/mod_filter.html
|
|