NAME

Apache::Wrapper - a simple framework for creating uniform, template driven content.

SYNOPSIS

httpd.conf:

<Location /someplace>
   SetHandler perl-script
   PerlHandler Apache::Wrapper

   PerlSetVar  TEMPLATE "templates/format1.html"
   PerlSetVar  REPLACE "the content goes here"
</Location>  

Apache::Wrapper is Filter aware, meaning that it can be used within 
an Apache::Filter framework without modification.  Just include the
directive

PerlSetVar Filter On

and modify the PerlHandler directive accordingly...

DESCRIPTION

Apache::Wrapper provides a simple way to insert content within an established 
template for uniform content delivery.  While the end result is similar to
Apache::Sandwich, Apache::Wrapper offers several advantages.

It does not use separate header and footer files, easing the pain of maintaining
syntactically correct HTML in seperate files.

It is Apache::Filter aware, thus it can both accept content from other
content handlers as well as pass its changes on to others later in the chain.

EXAMPLE

/usr/local/apache/templates/format1.html:

 <html>
      <head><title>your template</title></head>
              <title>your template</title>
      <body bgcolor="#778899">
              some headers, banners, whatever..
              <p>
 the content goes here
              </p>
              <p>some footers, modification dates, whatever...
      </body>
 </html> 


httpd.conf:

PerlModule Apache::Filter

<Location /someplace>
   SetHandler perl-script
   PerlHandler Apache::Wrapper Custom::SomeOtherHandler

   PerlSetVar  TEMPLATE "templates/format1.html"
   PerlSetVar  REPLACE "the content goes here"
   PerlSetVar  Filter On
</Location>

Now, a request to http://localhost/someplace/foo.html will insert the contents of
foo.html in place of "the content goes here" in the format1.html template and pass
those results to Custom::SomeOtherHandler.  The result is a nice and tidy way to 
control any custom headers, footers, background colors or images, in a single html
file.

NOTES

 TEMPLATE is relative to the ServerRoot - this may change in future releases, depending
 on demand.

 REPLACE defaults to "|", though it may be any character or string you
 like - metacharacters are disabled in the search, so sorry, no regex for now... 

 Verbose debugging is enabled by setting $Apache::Wrapper::DEBUG=1 or greater.
 To turn off all debug information, set your apache LogLevel above info level.

 This is alpha software, and as such has not been tested on multiple platforms or
 environments.  It requires PERL_LOG_API=1, PERL_FILE_API=1, and maybe other hooks
 to function properly.

FEATURES/BUGS

If Apache::Wrapper finds more than one match for REPLACE in the template, it 
will insert the request for the first occurrence only.  All other replacement
strings will just be stripped from the template.

Currently, Apache::Wrapper will return DECLINED if the content-type of the
request is not 'text/html'.

SEE ALSO

perl(1), mod_perl(3), Apache(3), Apache::Filter(3)

AUTHOR

Geoffrey Young <geoff@cpan.org>

COPYRIGHT

Copyright 2000 Geoffrey Young - all rights reserved.

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