Aran Clary Deltac > Catalyst-Model-DBIxResultSet-0.02 > Catalyst::Model::DBIxResultSet

Download:
Catalyst-Model-DBIxResultSet-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

Catalyst::Model::DBIxResultSet - A Catalyst model for DBIx::ResultSet.

SYNOPSIS ^

Create a model in you Catalyst apps Model directory:

    package MyApp::Model::DBIxResultSet;
    use Moose;
    use namespace::autoclean;
    
    extends 'Catalyst::Model::DBIxResultSet';
    
    __PACKAGE__->config(
        dsn      => ...,
        username => ...,
        password => ...,
        attr     => { ... },
    );
    
    __PACKAGE__->meta->make_immutable;
    1;

Instead of setting the dsn, etc, you can pass a pre-initialized DBIx::ResultSet::Connector object:

    __PACKAGE__->config(
        connector => $my_connector,
    );

Then in your controllers:

    my $model = $c->model('DBIxResultSet');
    my $rs = $model->resultset('users');
    $c->stash->{users} = $rs->array_of_hash_rows();

DESCRIPTION ^

This class is a Catalyst Model that wraps around DBIx::ResultSet.

ATTRIBUTES ^

All attributes are typically set using the __PACKAGE__->config() paradigm as outlined in the "SYNOPSIS".

dsn

The DSN for connecting to a database. See DBI for more information on what DSNs look like. This attribute it required unless you directly set the "connector" attribute.

username

The username to access your database with.

password

The password to access your database with.

attr

A hash ref of attributes. See DBI for valid attributes.

connector

The DBIx::ResultSet::Connector object. This defaults to a new connector using the dsn, username, password, and attr attributes.

MEHTODS ^

resultset

    my $users = $model->resultset('users');

See "resultset" in DBIx::ResultSet::Connector.

format_datetime

    my $date_time = $model->format_datetime( DateTime->now() );

See "format_datetime" in DBIx::ResultSet::Connector.

format_date

    my $date = $model->format_date( DateTime->now() );

See "format_date" in DBIx::ResultSet::Connector.

format_time

    my $time = $model->format_time( DateTime->now() );

See "format_time" in DBIx::ResultSet::Connector.

AUTHOR ^

Aran Clary Deltac <bluefeet@gmail.com>

LICENSE ^

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

syntax highlighting: