in reply to CGI::Application/HTML::Template problem

How (Not) To Ask A Question: Only Post Relevant Code

Please break your problem down and ask again. You seem convinced that problem has to do with your usage of HTML::Template, so write a small throw-away script* that allows you pin point the problem easier. You might discover that the error does not involve HTML::Template, but instead CGI::App ... start small.

* People got tired of rewriting these throw away scripts they use to test code and starting writing Test Suites to keep them from pulling their hair out over debugging Big Balls of Mud, BTW. ;)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)
  • Comment on Re: CGI::Application/HTML::Template problem

Replies are listed 'Best First'.
Re^2: CGI::Application/HTML::Template problem
by stonecolddevin (Parson) on Jan 12, 2006 at 16:49 UTC
    Thanks very much jeffa...i've modified it to what i think is appropriate. what test suites would you recommend?
    meh.

      That's a start, but try breaking it down even further into a command line script that only uses DBI and HTML::Template:

      use strict; use warnings; use HTML::Template; use DBI; my $id = shift || 42; my $dbh = DBI->connect( ... ); my $tmpl = HTML::Template->new(filehandle => \*DATA); my $product = $dbh->selectall_arrayref(q{ SELECT image, price, description, serial FROM product WHERE id = ? }, {Slice => {}}, $id); # i think it's better to use a variable instead of # passing the results from the query directly to the # $tmpl->param method (easier debugging) $tmpl->param(product => $product); print $tmpl->output; __DATA__ <tmpl_loop product> image: <tmpl_var image> price: <tmpl_var price> description: <tmpl_var description> serial: <tmpl_var serial> </tmpl_loop>
      Look into the CPAN test suites for more about that. Test::More, Test::Simple, etc.

      jeffa

      L-LL-L--L-LL-L--L-LL-L--
      -R--R-RR-R--R-RR-R--R-RR
      B--B--B--B--B--B--B--B--
      H---H---H---H---H---H---
      (the triplet paradiddle with high-hat)