[cgiapp] Re: Loading DBI hashref into HTML::Template Table

Mark Stosberg mark at summersault.com
Thu Sep 25 21:04:03 EDT 2008


On Thu, 25 Sep 2008 15:18:55 -0700
adam at spatialsystems.org wrote:

> I found this method on PerlMonks and can't get it to work.  How do I get
> it to work?  I want a simple way to load my DB query into a HTML table. 
> Thanks for any advice.

Adam,

Instead of 'selectall_hashref', you need $self->dbh->selectall_arrayref($sql, { Slice => {} });

But look into DBIx::Simple, it has a more intuitive interface to DBI. In
this case, the code difference would be: 

 selectall_arrayref($sql, { Slice => {} })

Becomes:

 query($sql)->hashes

    Mark

-- 
http://mark.stosberg.com/





More information about the cgiapp mailing list