On Mon, 2003-07-28 at 19:15, Christopher L. Everett wrote:
> Heh, I was trying to do templates that would use custom plugins. Then
> I could vary the PLUGIN_BASE to get same named plugins obtaining their
> data in slightly different ways.
That sounds obscure and hard to debug. I still suggest you ditch
Apache::Template and do this the easy way, with a custom handler.
Apache::Template basically exists just to make configuration easy for
people who want a very vanilla setup, so if it doesn't make it easy for
you then you shouldn't use it.
Here's a sample handler cut-and-pasted from Andy's OSCON talk:
package My::Apache::Handler;
use strict;
use Apache;
use Apache::Constants qw(OK SERVER_ERROR DECLINED);
use lib qw( /home/abw/oscon/lib );
use My::Template;
our $VERSION = 1.00;
our $TT;
sub handler {
my $r = shift;
my $output;
my %params = $r->method() eq 'POST'
? $r->content() : $r->args();
my $template = $r->path_info()
|| 'index.html';
$template =~ s[^/][]g;
$TT ||= My::Template->new();
$r->content_type('text/html');
$r->send_http_header();
$TT->process($template, \%params, $r)
|| return error($r, $TT->error());
return OK;
}
sub error {
my $r = shift;
$r->log_error(@_);
return SERVER_ERROR;
}
- Perrin
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates