[Catalyst] How and where to run a method at Catalyst start up?
Emmanuel Quevillon
tuco at pasteur.fr
Wed May 20 12:44:48 GMT 2009
Tomas Doran wrote:
> Emmanuel Quevillon wrote:
>> Thanks to try helping me. Here is the Trace from Devel::SimpleTrace.
>> Actually, the error is not even when I try
>> to call my method from my Catalyst::Model but when I start the dev
>> server :
>
> Aha, yes - the stack trace makes it fairly clear what's happening!
>
> Catalyst is trying to create your Model::Mapping _before_ it creates
> your other model..
>
> And creating an instance of Model::Mapping relies on the other model
> having been setup first.
>
Ok understood ! :)
>> I'll do it and post it to the list (github).
>
> Ok, and having looked at the code - that isn't the issue that you're
> having in that test app..
>
> The result classes for your DBIC models were in the wrong place, so DBIC
> wasn't finding them, ergo the call to ->model returning undef..
>
Well yes, it is because when I created my classes using
schema_loader, it created a 'Result' dir under Startup(2) direcotry.
But with the application I started earlier (BiblioList), this
directory wasn't present. So I decided to remove it :(
And the diff is that in BiblioList, It uses load_classes instead of
load_namespaces. Why this changes? I don't know, probably an API
change from DBIx::Class I used before.
Anyway, I read DBIx::Class::Schema doc and now see the diff between
the 2 methods. However don't know if one is better than the other one?
> I have also fiddled with the code to make it not order sensitive, and (I
> think) more elegant.
I looks more PROFESSIONAL anyway ;) !
>
> http://github.com/bobtfish/startup/tree/ea22d1ac4af4a9e9f46dbbfd0c9f9963ede3fa5f
>
>
> Cheers
> t0m
Thanks for your time Tom!
Cheers
--
-------------------------
Emmanuel Quevillon
Biological Software and Databases Group
Institut Pasteur
+33 1 44 38 95 98
tuco at_ pasteur dot fr
-------------------------
More information about the Catalyst
mailing list