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

[cgiapp] proposal to enhance load_tmpl() with default template name.


Hello,

Here's a proposal to enhance a load_tmpl() a bit more. Now that we have
CGI::Application::Forward, we can reliably get the current run mode if
we want to.

I propose the load_tmpl() default trying $runmode.'.html' as the
template name, if no file name is provided.

I believe this is backwards compatible because currently an undefined
value would get passed to HTML::Template, which would die in this case. 

This means for common cases you can just do:

 my $t = $self->load_tmpl;
 $t->param(\%params);
 return $t->output;

And the project may be easier to navigate because of the added
consistency between run mode names and file names.

Of course, using the ::AnyTemplate plugin, this could be even briefer if
you want:

 return $self->template->fill(\%params);

While I think power users will gravitate towards using the ::TT or
::AnyTemplate plugins, I think some will prefer having this simple
feature in the core, without having to learn or use additional
middleware to talk to a templating system.

Thoughts? 

    Mark

--
 . . . . . . . . . . . . . . . . . . . . . . . . . . . 
   Mark Stosberg            Principal Developer  
   suppressed     Summersault, LLC     
   765-939-9301 ext 202     database driven websites
 . . . . . http://www.summersault.com/ . . . . . . . .


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
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.