Hi, I'm developing my first Catalyst application, Windows, MySQL, DBIx and Template Toolkit. As part of this I've overcome various problems and now have a working app, but I'm having recurring difficulties understanding the relationship between DBIx, Catalyst and TT.
What I want is simply to select a row from a table by its ID (no problem), assign the 'name' field/column to a variable, and finally store it as a parameter in the session. For this I hoping you'll answer 2 questions: 1. Simply how to do this, or point me to an existing example (I've looked a few times, but maybe I'm looking for the wrong thing)? 2. How should I be doing this, as I'm new to Catalyst DBIx and TT. There is a certain amount of 'get it working' as opposed to how it should work, but I guess that's what catalyst is for? Catalyst Controller Code: sub Project :Local { my ($self, $c, $project_id) = @_; $c->stash(projects => [$c->model('DB::Project')->find({'Project_id', $project_id })]); die "App $project_id not found!" if !$c->stash->{projects}; # This all works fine # This is a guess and doesn't work ;-) $c->session{Project} => $c->stash->{projects}->project_name; # Where project_name is an accessor in the DBIx result set. } >From DB::Project __PACKAGE__->add_columns( "project_id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "project_name", { data_type => "varchar", is_nullable => 0, size => 255 }, Sample DB Table: CREATE project ( `Project_id` INT AUTO_INCREMENT , `Project_Name` VARCHAR(255) NOT NULL , `FK_Programme` INT NOT NULL , `Project_Desc` VARCHAR(255) NULL , ) Regards, Tadhg
_______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/