Kevin Old wrote:
Hello everyone,
I'm trying to use DBIx::Class with HTML::Template and I can't seem to
get it to work.
Here's how I'm calling DBIC and HTML::Template in my script:
my $tmpl = HTML::Template->new( filename => "single_stories.tmpl",
die_on_bad_params => 1);
my @stories = $schema->resultset('Stories')->search( { user_id => 1234 }
)->all;
if ( $stories ) {
$tmpl->param( stories => $stories );
print $tmpl->output;
}
Not sure if thats a transposition error,
but dont you want:
if ( [EMAIL PROTECTED] ) {
$tmpl->param( stories => [EMAIL PROTECTED] );
print $tmpl->output;
}
Anyway, take a look at the Cookbook, near the end there is a way to
inflate to a hashref, which would do what you want in this case I
suspect. Currently you'll have to write it yourself like in the
cookbook, but by next release it will be part of the dist.
Ash
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/