NAME

DBIx::Class::Sweet - Syntatic sugar for DBIx::Class

VERSION

Version 0.01

SYNOPSIS

This module adds syntatic sugar for setting up your DBIx::Class classes. It's motivation came from the fact that __PACKAGE__ is a rather ugly construct, specially when you've got a dozen of them.

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' );

};

EXPORTS

setup_class { class setup code }

This function takes a code block as its only parameter and tries to give special meaning to the code inside it. Particularly, every function call is translated to a class method call.

Besides that, this function also does some "default" setting up of your DBIx::Class subclass. It automatically loads PK::Auto and Core components and sets the table name to a sane default: the last part of your class name, lower-cased. So the default table for MyDB::Whatever::MyTable whould be 'mytable'.

CLASS METHODS

import

Makes the caller our subclass (and, thus, DBIx::Class subclass).

TODO

Add some real test cases.

Add more syntatic sugar (auto-joins jump into my mind).

AUTHOR

Nilson Santos Figueiredo Júnior, <nilsonsfj at cpan.org>

BUGS

This module does some tricky stuff. There might be some bugs lurking around.

Please report any bugs or feature requests directly to the author. If you ask nicely it will probably be implemented.

SEE ALSO

DBIx::Class

COPYRIGHT & LICENSE

Copyright 2006 Nilson Santos Figueiredo Júnior, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 132:

Non-ASCII character seen before =encoding in 'Júnior,'. Assuming CP1252