>>>>> "michael" == michael higgins <[EMAIL PROTECTED]> writes:
michael> Okay, thanks to both of you. I've managed to install both versions and
load them. /perl-status gives good reports for both. But, I must be missing
something big, becuase I keep serving up the TT tags in my .tt2 file. No joy.
michael> I've tried tweaking everything I know about. If anyone is interested
in getting this working with me, jump in. '-)
Mine requires support in the phase ahead of that to decide that an HTML
file is really a TT file:
package Stonehenge::FixupTT;
use strict;
## PerlFixupHandler Stonehenge::FixupTT
## warn __PACKAGE__;
use Apache2::Const qw(DECLINED OK);
use Template::Config;
Template::Config->preload(); # preload everything for sharing
sub handler {
my $r = shift;
my $content_type = $r->content_type;
my @tt2_mime = $r->dir_config->get("TT2Mime");
## warn $r->uri, ": fixuptt invoked as $content_type testing against
@tt2_mime";
if (defined($content_type) and @tt2_mime) {
my %table;
for (map split, @tt2_mime) { # whitespace delimiter
if ($_ eq "-") { # sole dash is flush table
%table = ();
} elsif (/^\+(.*)/) { # add item
$table{$1} = 1;
} elsif (/^-(.*)/) { # remove item
delete $table{$1};
} else {
$r->warn($r->uri, ": confusing TT2Mime entry: $_");
}
}
## require Data::Dumper;
## warn Data::Dumper::Dumper({ table => \%table, content_type =>
$content_type });
# table is built: let's see if it applies
if ($table{$content_type}) {
## warn $r->uri, ": is tt2:\n---\n", $r->as_string, "---\n";
$r->handler("modperl");
$r->add_config(['PerlResponseHandler Stonehenge::Apache2::Template']);
# $r->push_handlers(PerlResponseHandler =>
"Stonehenge::Apache2::Template");
## warn "handlers are now ",
@{$r->get_handlers('PerlResponseHandler')}, "\n";
return DECLINED;
}
## warn $r->uri, ": is not tt2";
}
return DECLINED;
}
1;
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates