[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] returning HTML::Templates from runmodes?


As one of those that don't use H::T (and I'm not alone), I'd be unhappy
with tightening the bonds between them.

Well, it would just be an option.
No one is forced to use it, but it would benefit those who do use H::T.

It depends on the implementation.

Well, the implementation I have in mind would benefit H::T users and not harm anyone else :-)

 One could easily say that we should
build in the same fucntionality for those of us that use Template
Toolkit with CGI::App.

The main advantage that I see by "tightening the bonds" with H::T is an increase in performance that is achieved by being able to use the print_to option of H::T. Basically this option allows you to not collect the whole template output in a scalar, but to instead print it out directly. This is currently to possible in CGI::App because runmodes are not allowed to print. If we let CGI::App handle generating the template output, it becomes an option.

I am not familiar with Template::Toolkit, but according to its documentation, output is produced like that:

 my $output = '';
    $tt->process('welcome.tt2', $vars, \$output)
        || die $tt->error(), "\n";

This approach does not separate the generation of the template from the generation of the output. Unless there is another way to use T::T (is there?), passing the whole output around as a reference to $output is the best you can do.

Therefore (by allowing you to return scalar-refs), CGI::App already supports T::T as much as is possible :-)

But users of H::T could gain by taking advantage of the separation between making the template (my $tmpl = new HTML::Template (.....) ) and making the output ($tmpl->output(print_to=>...).


Currently you can subclass for that functionality, however you would
want it.

I am subclassing a lot already.
It just seems some of the additions I make are very general and should be included in the original distribution.


Thilo


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.