NAME
Catalyst::Model::EmailStore - Email::Store Model Class
SYNOPSIS
# use the helper
create model EmailStore EmailStore dsn user password
# lib/MyApp/Model/EmailStore.pm
package MyApp::Model::EmailStore;
use base 'Catalyst::Model::EmailStore';
__PACKAGE__->config(
dsn => 'dbi:Pg:dbname=myapp',
password => '',
user => 'postgres',
options => { AutoCommit => 1 },
cdbi_plugins => [ qw/AbstractCount Pager/ ]
);
1;
# As object method
$c->model('EmailStore::Address')->search(...);
# As class method
MyApp::Model::EmailStore::Adress->search(...);
DESCRIPTION
This is the Email::Store
model class. It will automatically subclass all model classes from the Email::Store
namespace and import them into your application. For this purpose a class is considered to be a model if it descends from Email::Store::DBI
.
CAVEATS
Due to limitations in the design of Email::Store the main model class (e.g. MyApp::Model::EmailStore) is not part of the inheritance chain that leads up to Class::DBI so you can't use any CDBI plugins there. To alleviate this problem a config option named cdbi_plugins is provided. All classes named therein (without the mandatory Class::DBI::Plugin
prefix) will be required and imported into Email::Store::DBI
.
Also I've take the liberty to remove the overloading of 'bool' that is done automatically by CDBI and would cause $c->model( XXX ) to fail.
I also suggest that you keep your Email::Store tables in their own database separate from your other tables
METHODS
new
Initializes Email::Store::DBI and loads model classes according to Email::Store->plugins. Actually it reimplements the plugin mechanism of Email::Store so you are on your own if you rely on modifications to this class itself. Also attempts to borg all the classes.
BUGS
Probably many as this is the initial release.
SEE ALSO
AUTHOR
Sebastian Willert <willert@cpan.org>
Many thanks to Brian Cassidy <bricas@cpan.org> for inspiration and help with bringing this class to CPAN.
COPYRIGHT
Copyright (C) 2005 by Sebastian Willert
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.