[Catalyst] Variable in where clause

Matt S Trout dbix-class at trout.me.uk
Wed Sep 14 08:48:16 CEST 2005


On Tue, Sep 13, 2005 at 11:51:21PM -0400, Danh Nguyen wrote:
> Hi,
> 
> I wantto put a variable in the WHERE clause in Template. something like this:
> 
> [% USE DBI('dbi:SQLite:C:\minimojo.db ') %]

No. Don't do that!

You already have your model classes (Class::DBI or DBIx::Class) providing
an OO interface to your database. You should pass objects through to the
template by putting them in $c->stash as part of your C::Whatever code.

Use Catalyst::Helper::Controller::Scaffold to create yourself a simple
controller class and a set of templates for one of your tables, and see
how that does it - better still, watch the movie:

http://dev.catalyst.perl.org/wiki/Movies

-- 
     Matt S Trout       Specialists in perl consulting, web development, and
  Technical Director    UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list