Ovid, Am 16.08.2009 um 17:09 schrieb Ovid:
Hi all, This should be painfully obvious, but I don't see it :)For a personal project, I want users to be able to click on a letter and get a list of countries starting with that letter. I can do this:my $letters = $c->model('DB')->storage->dbh->selectcol_arrayref('select distinct(substr(name,1,1)) as letter from country order by letter'); $c->stash->{letters} = $letters;But the country list is static and I want this available at startup. 'sub begin' fails because that's called once per request, not once per app.What's the recommend way of handling this? (I'm using DBIx::Class for the model)
I've done something similar with C::P::I18N::DBI (see: http://search.cpan.org/perldoc?Catalyst::Plugin::I18N::DBI ) but I think it wouldn't be recommended to build a plugin in your case.
matt -- rainboxx Matthias Dietrich Freier Software Engineer rainboxx | Tel.: +49 (0) 151 / 50 60 78 64 Tölzer Str. 19 | Mail: m...@rainboxx.de 70372 Stuttgart | WWW : http://www.rainboxx.de XING: https://www.xing.com/profile/Matthias_Dietrich18 GULP: http://www.gulp.de/profil/rainboxx.html
PGP.sig
Description: Signierter Teil der Nachricht
_______________________________________________ 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/