Hi,

I am seriously considering writing a system to create
DBIx Classes via a configuration file.  Since the
default for creating these classes are primarily
package method calls I think this could be pretty
easy.

So we could replace:

package myapp::Schema::foo

__PACKAGE__->load_components( ... );
__PACKAGE__table('foo');

(rest of your setup)

With (something like in evil YAML)

Schema:
  foo:
    table: foo
    load_components:
      - comp1
      - comp2


and so forth.

We'd need an standard for package methods that can
have multiply invocations, most the relationship
stuff, but I think something like:

has_many:
  bars: myapp::Schema::bar
    foreign.id: self.barfk
  bats: myapp::Schema::bat
    foreign.id: self.batfk

The above is just a first guess as to how this could
work.  I'd use config::any or similar so that you can
use the configuration of your choice.  My imagination
is telling me this could be a new method on Schema,
that would be like ->load_classes, but would accept a
Perl structure to auto create the classes.

So I was wondering what people thought of the idea, if
you'd find it useful or am I off in my own world?

One objection I can see is that it makes it harder to
add active record style methods, but you could always
specify a custom result or resultclass to handle this.

Anyway, just my Sunday afternoon rumblings.  Would
appeciate thoughts and feedback from the group.

--John
    



       
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! 
FareChase.
http://farechase.yahoo.com/

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/dbix-class@lists.rawmode.org/

Reply via email to