Hi all,
I am developing a Catalyst App and I'd like to know how to launch a
method at Catalyst start up?
The idea is to check and create some kind of a data structure that
will be loaded into memory (__PACKAGE__->{mydata} = { ... }) of my
application and will be then accessible at anytime from anywhere in
any controller as
sub foo: Local {
my($self, $c) = @_;
my $personnal_data = $self->_get_mydata();
...
}
sub get_mydata will reside into MyApp.pm
But how can I access my database within MyApp.pm ?
I tried (in MyApp.pm):
sub _test {
my $self = shift;
@rs = $self->comp('MyApp::DB::Table')->search({ id => { '>' => 2 } });
#If I print each values of @rs
#it prints something like 'MyApp::DB::Table=HASH(....)
#But from each item of my array, if I tried any call to
#column sub (like $_->id()) I get 'Unkown error'
#Also it looks like $_ is a 'DBIx::Class' only
}
Has somebody any clue how could I solve my problem
Thanks in advance
Regards
--
-------------------------
Emmanuel Quevillon
Biological Software and Databases Group
Institut Pasteur
+33 1 44 38 95 98
tuco at_ pasteur dot fr
-------------------------
_______________________________________________
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/