On Sat, Oct 4, 2008 at 9:31 AM, Peter Karman <[EMAIL PROTECTED]> wrote: > You don't need a real plugin unless you need to override the dispatch process. > But I often put convenience methods in my MyApp.pm base class. So implement > your > idea #1 and then add: > > package MyApp; > > sub logdb { > my $c = shift; > my $msg = shift or croak "msg required"; > $c->model('AppDB')->add($msg); > }
I would set up a config key for the model to make things flexible: sub log_model { my($c) = @_; return $c->model($c->config->{log_model}); }; sub logdb { my $c = shift; my $msg = shift or croak "msg required"; $c->log_model->add($msg); } you can do this with controllers too, if you decide you need different models per controller -- edenc.vox.com _______________________________________________ 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/