[htmltmpl] H::Template and CGI::Application
Brought to you by:
samtregar
From: Daniel A. <dan...@sn...> - 2004-10-14 13:18:37
|
Hello, I've been using HTML::Template for a while, but am having a weird problem when using it in a CGI::Application app. Basically, when I call $template->output, the application requests the page from the server twice, instead of once if I just create and return my own HMTL. CGI::Application is based around run modes, where calling http://localhost/myapp?rm=myrun will send you to a method in a class derived from CGI::Application. In the method I'm just getting some stuff from a database table, creating the template like this: $self->load_tmpl($template_file, case_sensitive => 1); and sending it back like this: return $template->output; # for CGI::Application or this: $self->page = $template->output; # for CGI::Application::Plus This is running under Apache 2.0.50 and mod_perl; HTML::Template 2.7; I've tried it under CGI::Application 1.30, CGI::Application::Plus 1.14, and CGI::Builder::CgiAppAPI v. 1.24 (all of these do basically the same thing). If I comment out the $template->output() call, the problem goes away: clicking on a like to the run-mode in question results in one call to that mode (but with no output); restoring the output() call results in two calls to the run mode. I've been reading various man pages but I'm still baffled. Anyone have an suggestions? Thanks for any help, Dan |