[cgiapp] Anyone using HTML::Template::Expr ?

Joshua Miller unrtst at gmail.com
Tue Sep 16 17:06:39 EDT 2008


On Tue, Sep 16, 2008 at 3:50 PM, Rhesa Rozendaal <perl at rhesa.com> wrote:

>
>  Michael Peters wrote:
>>
>>> If you're talking about C::A's load_tmpl() function, then you'll need to
>>> override it and replace it with your own version that uses H::T::E.
>>>
>>
> Mark Jaffe wrote:
> > Thanks for the info; it is the second case that is concerning me, which
> > is what I need to do. I am outside my comfort-zone with an override, and
> > just need to see an example/tutorial of how it is done. Any suggestions
> > for how to override load_tmpl? My initial attempt failed due to
> stupidity.
>
>
> Well, you copy all the code in CGI::Application::load_tmpl, and replace
> "HTML::Template" with "HTML::Template::Expr".
>
> Or you could be even fancier, and do what
> CGI::Application::Plugin::HTCompiled does. Slightly more cumbersome to use
> in your own applications, but it does show how to override load_tmpl.
>
>
> I do think your question is more justification for the small refactoring I
> proposed a couple of weeks ago (to pull out the hard-coded "HTML::Template"
> into a constant method). Ah well.
>


I found CGI::Application::Plugin::AnyTemplate to be more than sufficient.

Personally, I use HTML::Template::Pro (XS module that does single pass
template filling-in) - I love it's speed, low memory footprint,
HTML::Template compatibility, and it has HTML::Template::Expr support built
in. So, I just copied the CAP::AnyTemplate::HTMLTemplate module, renamed to
HTMLTemplatePro.pm, and updated the few lines that needed changed to get
HT:Pro support.

It'll work out of the box with HTML::Template::Expr though, if that's what
you're after.

I wouldn't mind it being the standard, but there's really no need, cause
it's there and isn't hindered by the built in ->load_tmpl stuff.
--
Josh I.


More information about the cgiapp mailing list