[Catalyst] Need some DBIC syntax help

Dennis Daupert ddaupert at sbcglobal.net
Sat Dec 31 01:54:30 CET 2005


I'm wrestling with DBIx-Class, down for the count.... 
  
  Using perl scripts, I can insert and query my SQLite users table, 
  but Catalyst/DBIC throws me down the stairs.  
  
  Here is the users table list my template displays:  
  MyApp2::Model::DBIC::Users=HASH(0x19d8e80) 
  MyApp2::Model::DBIC::Users=HASH(0x19d94e0) 
  MyApp2::Model::DBIC::Users=HASH(0x19e6030)  
  
  But the actual table contains are:  
  1,Skeeter,Nitney,snitney,pass,snitney at bigtux,1 
  2,Suzie,Creamcheese,screamcheeze,pass,screamcheeze at bigtux,1 
  3,Goober,Pease,gpease,pass,gpease at bigtux,1  
  
  Some details.... 
  ------------ 
  package MyApp2::Model::DBIC::Users; 
  use strict; 
  use warnings; 
  use base qw/MyApp2::Model::DBIC/;  
  __PACKAGE__->table('users'); 
  __PACKAGE__->add_columns(qw/id lname fname username password email active/); 
  __PACKAGE__->set_primary_key('id'); 
  ------------ 
  package MyApp2::Controller::Admin::Users;  
  sub list : Local {     
    my ($self, $c) = @_;     
    my @Users = MyApp2::Model::DBIC::Users->search({ active => 1 });     
    $c->stash->{'template'} = 'includes/admin/users/list.tt';     
    $c->stash->{'Users'} = \@Users; 
  }; 
  ------------ 
  includes/admin/users/list.tt:
  
  [% IF Users.size %]   
    [% FOREACH user IN Users %]      
      <h4>[% user %]</h4>   
    [% END %] 
  [% END %] 
  ------------  
  I'll also have a syntax question or two regarding inserts, 
  but first things first, I want to make sure I can view 
  what's in the table.  
  
  /dennis 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20051230/ad384223/attachment.htm


More information about the Catalyst mailing list