NAME

Apache::SSI - Implement Server Side Includes in Perl

SYNOPSIS

wherever you choose:

<Files *.phtml> SetHandler perl-script PerlHandler Apache::SSI </Files>

You may wish to subclass Apache::SSI for your own extentions

package MySSI;
use Apache::SSI ();
@ISA = qw(Apache::SSI);

#embedded syntax:
#<!--#something param=value -->
sub ssi_something {
   my($self, $attr) = @_;
   my $cmd = $attr->{param};
   ...
   return $a_string;   
} 

DESCRIPTION

Apache::SSI implements the functionality of mod_include for handling server-parsed html documents. In my mind, there are two main reasons one might want to use it: you can sub-class it to implement your own custom SSI directives, and/or you can use an OutputChain to get the SSI output first, then send it through another PerlHandler.

Each SSI directive is handled by an Apache::SSI method with the prefix "ssi_". For example, <!--#printenv--> is handled by the ssi_printenv method. attribute=value pairs are parsed and passed to the method in an anonymous hash.

SSI Directives

This module supports the same directives as mod_include. At least, that's the goal. =) For methods listed below but not documented, please see mod_include's online documentation at http://www.apache.org/ .

  • echo

  • exec

  • fsize

  • flastmod

  • include

  • printenv

  • set

  • perl

    See http://perl.apache.org/src/mod_perl.html for more details on this.

  • config

    Not supported yet.

CAVEATS

I haven't tried using Apache::OutputChain myself, so if this module doesn't work with OutputChain, please let me know and I'll try to fix it (do modules have to be "OutputChain-friendly?").

The version number is 1.90, but that doesn't mean it's stable yet. This is the first version of a virtually complete rewrite of Doug's version 1.14, and I didn't want to decrease the version number.

The date output formats are different from mod_include's format. Anyone know a nice way to get the same format without resorting to HTTP::Date?

Currently, the way <!--#echo var=whatever--> looks for variables is to first try $r->subprocess_env, then try %ENV, then the five extra environment variables mod_include supplies. Is this the correct order?

TO DO

I need to write a few tests that run under "make test".

BUGS

The only xssi directives currently supported are 'set' and 'echo'.

<!--#perl--> directives can only take one argument.

SEE ALSO

mod_include, mod_perl(3), Apache(3), HTML::Embperl(3), Apache::ePerl(3), Apache::OutputChain(3)

AUTHOR

Ken Williams ken@forum.swarthmore.edu

Based on original version by Doug MacEachern dougm@osf.org

COPYRIGHT

Copyright 1998 Swarthmore College.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.