[Catalyst] Class::DBI::Loader borging too much too fast?

Dominique Quatravaux dom at idealx.com
Wed Jul 6 19:49:33 CEST 2005


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

Dear Catalystists (sic),

I'm coding an app from scratch under Catalyst. Parts of my model are
very straightforward (list of objects all alike, tabular-minded, CRUD
controllers) and the intelligent-defaults approach of Catalyst +
Class::DBI::Loader is working wonders there.

But other model classes are more complex: I have to store trees and
even algebraic formulas into the db. At such times the default
table_name -> MyApp::M::TableName thing proves counterproductive as I
may not use *any* of the CRUD accessors that Class::DBI::Loader offers.

Also, I'm afraid that saying "use MyApp::M::Foo" in a piece of code
outside the Web app (e.g. a cron script) is not going to work, because
the Class::DBI::Loader singleton has to be created before the
persistence part of MyApp::M::Foo will work (see my earlier thread
"Initialization ordering, how?" starting at
http://lists.rawmode.org/pipermail/catalyst/2005-June/000769.html ).
And of course, a model class without the persistence is much less fun.
In other words, MyApp::M::Foo doesn't correctly encapsulate it's
persistence aspect.

To close the two issues at once, I'd like Class::DBI::Loader->new() to
refrain from borging everything at startup, and be taught to borg
piecewise and when requested. I'd like to be able to say:

   package MyApp::M::SimpleCrudModel;
   use base "MyApp::M::CDBI";

 
Class::DBI::Loader->new_dont_borg(__PACKAGE__->options())->load_class(__PACKAGE__);
# Borgs just this class

 ...

  package MyApp::M::MoreComplexModel;
   use base "MyApp::M::CDBI";

  # No borging here thank you, I'm doing my own sauce

I think I could handle the coding / testing / documenting. Thoughts?
Better ideas than ->new_dont_borg() for the name of the new constructor?

- --
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

iD8DBQFCzBmsMJAKAU3mjcsRApv4AKC9ZO9RLNX0c6epRj+R3Od1ACtl4ACgwbPF
49+PYAcxQPpa4Awgz26P9hI=
=gsGq
-----END PGP SIGNATURE-----





More information about the Catalyst mailing list