On Tue, Feb 12, 2002 at 12:01:24PM +0100, Harald Joerg wrote: > I'd rather go for subclassing Template::Provider
Good call! Here is a first attempt at an http provider. http://andywardley.com/perl/Template-HTTP-0.01.tar.gz I haven't uploaded it to CPAN yet, and won't until I make another developer release (RSN) due to the fact that it relies on a patch to Template::Context which isn't out there yet. You'll need to grab the latest CVS sources or apply this patch to Template::Context against the 2.06d version: http://andywardley.com/perl/TT2-HTTP-diff Now you can do this: use Template; use Template::Provider::HTTP; my $tt2 = Template->new({ PREFIX_MAP => { http => Template::Provider::HTTP->new(), }, }); # in a template: [% INCLUDE http://tt2.org/t/templates/hello %] All template directives work as expected: INSERT, INCLUDE, PROCESS and WRAPPER. Note that in-memory caching should work (although I haven't tested it) but to-disk compilation is definately broken due to the base class Template::Provider using stat() to check source template modification time (which doesn't work across the network, of course). Enjoy! A
