On 29 Sep 2011, at 18:36, Nicholas Wehr wrote:

perhaps a simple way:

my $rs = $c->model("DB::Group")->all;
while (my $group = $rs->next) {
       for my $user ($ group->users ) {
     # do stuff
       }
}


Less good - this is implying that the code goes into the controller layer, whereas this looks like an operation that should be performed in the data model.

I.e. $c->model("DB::Group")->do_stuff_to_all_groups(%data);

or similar, so putting the code in the DBIC layer is entirely appropriate and gives you much nicer separation of concerns, as the controller knows nothing about the specifics of how the operation it requests is performed.

Cheers
t0m


_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to