GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Catalyst::Model::DBIC::Plain(3) User Contributed Perl Documentation Catalyst::Model::DBIC::Plain(3)

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__->load_classes;
    __PACKAGE__->compose_connection(__PACKAGE__, @conn_info);

    1;

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

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

    # lib/MyApp/Controller/MyController.pm
    $c->comp('DBIC')->class('user')->search(...);

    # or
    MyApp::Model::DBIC::User->search(...);

This is the "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.

Catalystifies DBIx::Class and makes the model model class a component.

Catalyst, DBIx::Class

Danijel Milicevic, "info@danijel.de"

Dan Kubb, Matt S. Trout

This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
2005-11-26 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.