[Catalyst] Initialization ordering, how?

Dominique Quatravaux dom at idealx.com
Thu Jun 30 14:12:53 CEST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dear Catalyst hackers,

I have a model class, Foo::M::Bar, and I want it to perform

   __PACKAGE__->columns(Stringify => "name");

at an appropriate time. If I put this at the package's top level, then
I'm out of luck if Foo::M::CDBI is not loaded before me by the
Module::Pluggable::Fast engine. Ditto if I define a

   package Foo::M::Bar::Initializer;
   use base 'Catalyst::Base';
   sub new {
       Foo::M::Bar->columns(Stringify => "name");
   }

because by being a plug-in myself I still have no guarantee that the
other plug-in I depend on, Foo::M::CDBI in my case, initializes itself
before me.

I know I would avoid the problem if I renamed Foo::M::Bar into
Foo::M::CDBI::Bar thereby guaranteeing the depth-first ordering, but
mind you I *demand* that my model classes dissimulate which
persistence layer they use :-) because I want to be able to change
that particular aspect later (=> SPOPS) without altering any
controller or view code.

What should I do ?

- --
Dominique QUATRAVAUX                           Ingénieur senior
01 44 42 00 08                                 IDEALX

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCw+HFMJAKAU3mjcsRAkWXAJ0ZPdpkmcEo/VytVpZaiS/IHhOyPgCfUWzD
ISVOK411ZaeVy7Q+FvrO7Ko=
=La2N
-----END PGP SIGNATURE-----





More information about the Catalyst mailing list