NAME Catalyst::Model::DBI - DBI Model Class SYNOPSIS # use the helper to create a model for example perl script/myapp_create.pl model MyModel DBI dsn username password # lib/MyApp/Model/DBI.pm package MyApp::Model::DBI; use base 'Catalyst::Model::DBI'; __PACKAGE__->config( dsn => 'DBI:Pg:dbname=mydb;host=localhost', username => 'pgsql', password => '', options => { AutoCommit => 1 }, ); 1; # or load settings from a config file via Config::General for example # in your myapp.conf you could have name MyApp dsn "DBI:Pg:dbname=mydb;host=localhost" username pgsql password "" AutoCommit 1 # note that config settings always override Model settings # do something with $dbh inside a controller ... my $dbh = $c->model('MyModel')->dbh; # do something with $dbh inside a model ... my $dbh = $self->dbh; DESCRIPTION This is the "DBI" model class. METHODS new Initializes DBI connection $self->dbh Returns the current database handle. $self->stay_connected Returns a connected database handle. $self->connected Returns true if the database handle is active and pingable. $self->connect Connects to the database and returns the handle. $self->disconnect Executes rollback if AutoCommit is active, disconnects and unsets the database handle. SEE ALSO Catalyst, DBI AUTHOR Alex Pavlovic, "alex.pavlovic@taskforce-1.com" COPYRIGHT Copyright (c) 2005 - 2012 the Catalyst::Model::DBI "AUTHOR" as listed above. LICENSE This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.