[Dbix-class] [ANNOUNCEME] Catalyst::Model::DBIC::Plain

Danijel Milicevic Danijel.Milicevic at rawmode.org
Tue Aug 9 20:02:28 CEST 2005

Hey lists,

since Matt released DBIC 0.01 last night it kinda made sense to release
C::M::DBIC::Plain as well for the Catalyst users to play with. Just to
fill this announcement up a little bit, here is the pod:

=head1 NAME

Catalyst::Model::DBIC::Plain - DBIC Model Class


    # lib/MyApp/Model/DBIC.pm
    package MyApp::Model::DBIC;
    use base 'Catalyst::Model::DBIC::Plain';

    my @conn_info = ( $dsn, $username, $password, \%dbi_attributes );

    __PACKAGE__->compose_connection(__PACKAGE__, @conn_info);


    # lib/MyApp/Model/DBIC/User.pm
    package MyApp::Model::DBIC::User;
    use base 'DBIx::Class::Core';

    __PACKAGE__->add_columns(qw/id username password email clearance/);
        clearance => 'MyApp::Model::DBIC::Clearance',
        { 'foreign.id => 'self.clearance' }

    # lib/MyApp/Controller/MyController.pm

    # or


This is the C<DBIx::Class> model class for Catalyst. Whilst it allows
you to
use DBIC as your model in Catalyst, it does not make your tables classes
Catalyst-specific, so you can still use them in a non-Catalyst context.

Thanks to the helper script you can setup your model as easy as:
$ script/myapp_create.pl model DBIC DBIC::Plain dsn user pass

Danijel Milicevic

More information about the Dbix-class mailing list