Apache2::WebApp::Plugin::DBI - Database interface wrapper
my $obj = $c->plugin('DBI')->method( ... ); # Apache2::WebApp::Plugin::DBI->method() or $c->plugin('DBI')->method( ... );
A database independent interface that gives your application universal support across many databases including MySQL, PostGRe, and Oracle. Also supports many common flat file formats.
This package is part of a larger distribution and was NOT intended to be used directly. In order for this plugin to work properly, the following packages must be installed:
Apache2::WebApp Apache::DBI DBI Params::Validate
From source:
$ tar xfz Apache2-WebApp-Plugin-DBI-0.X.X.tar.gz $ perl MakeFile.PL PREFIX=~/path/to/custom/dir LIB=~/path/to/custom/lib $ make $ make test $ make install
Perl one liner using CPAN.pm:
$ perl -MCPAN -e 'install Apache2::WebApp::Plugin::DBI'
Use of CPAN.pm in interactive mode:
$ perl -MCPAN -e shell cpan> install Apache2::WebApp::Plugin::DBI cpan> quit
Just like the manual installation of Perl modules, the user may need root access during this process to insure write permission is allowed within the installation directory.
Unless it already exists, add the following to your projects webapp.conf
[database] driver = mysql host = localhost name = database user = foo password = bar auto_commit = 0
Make a new database connection.
my $dbh = $c->plugin('DBH')->connect({ driver => 'mysql', host => 'localhost', name => 'database', user => 'bar', password => 'baz', commit => 1 || 0, }); my $sth = $dbh->prepare("SELECT * FR..");
Apache2::WebApp, Apache2::WebApp::Plugin, Apache::DBI, DBI
Marc S. Brooks, <mbrooks@cpan.org> - http://mbrooks.info
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/artistic.html
To install Apache2::WebApp::Plugin::DBI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache2::WebApp::Plugin::DBI
CPAN shell
perl -MCPAN -e shell install Apache2::WebApp::Plugin::DBI
For more information on module installation, please visit the detailed CPAN module installation guide.