Skip Menu |

This queue is for tickets about the CGI-Application-Plugin-AnyTemplate CPAN distribution.

Report information
The Basics
Id: 13618
Status: resolved
Priority: 0/
Queue: CGI-Application-Plugin-AnyTemplate

People
Owner: Nobody in particular
Requestors: MARKSTOS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.05
Fixed in: 0.07



Subject: wish: support for non-file templates
I'm working on CAP::BREAD, which currently has default templates embedded in the Perl files. We would like to use ::AnyTemplate on the project, and it would be nice if it supported loaded templates from sources other than files. I see that we can pass 'scalarref => $our_template' to HTML::Template, but I'm sure it will get confused when a file name to open is also passed. One possible way to design for this is to check the 'file name' parameter that is passed in to see if is a scalarref. If so, assume it is the template. If the underlying template engine doesn't support this, you could either die (easy), or emulate the feature (harder). Thanks! Mark
From: PURDY
[PURDY - Sat Jul 9 16:25:14 2005]: CGI::Application's load_tmpl would be cool to have this, too.
This feature has been added in version 0.07, which should show up on CPAN shortly. You can now do: my $template = $self->template->load(string => \$some_text); Or: my $template = $self->template->load(\$some_text); Or even: $self->template->fill(\$some_text, \%params); Michael