[Dbix-class] RFC: DBIx::Class::Sweet
Nilson Santos Figueiredo Junior
acid06 at gmail.com
Mon Apr 3 08:17:31 CEST 2006
Well, It's a module that adds some syntatic sugar to DBIx::Class.
Currently, it only makes the DBIx::Class subclass "setup" easier on
the eyes but I intend to develop it further as I see fit, maybe adding
more substancial features.
Here's what the code should look like when using it:
package World::Person;
use DBIx::Class::Sweet;
setup_class {
add_columns(qw/id name country_id/);
set_primary_key('id');
belongs_to( country => 'World::Country', 'country_id' );
};
I particularly think that __PACKAGE__ is ugly as hell. So this fixes it.
I had to implement some sort of hacks to make it work e struggled a
little bit with Class::C3. So if someone could take a look at the
source code and maybe suggest better options of achieving the same
thing, I'd be glad.
Note that in order for it to work correctly, I actually needed to do
things such as making the caller inherit from us manually, since I
couldn't manage to make it work with "use base 'DBIx::Class::Sweet'".
Any thoughts on this one would be welcome.
You can fetch it at:
http://www.nilson.org/DBIx-Class-Sweet-0.01.tar.gz
Or you can wait for PAUSE to stop hating me and replicate it
throughout the mirrors (whenever I upload something to CPAN directly
from my computer, I get some weird "nosuccesscount[0] error[...An
Error Occurred....An Error Occurred.400 FTP return code 000..]
(paused:638)" errors).
Any suggestions or critics are welcome.
I know, I know, the name is a blatant rip-off. But I just couldn't
think of anything better right now. So if this bothers
Class::DBI::Sweet authors, please, tell me.
-Nilson Santos F. Jr.
More information about the Dbix-class
mailing list