Module::Build::Database::PostgreSQL
In Build.PL :
my $builder = Module::Build::Database->new( database_type => "PostgreSQL", database_options => { name => "my_database_name", schema => "my_schema_name", # Extra items for scratch databases : append_to_conf => "text to add to postgresql.conf", after_create => q[create schema audit;], }, database_extensions => { postgis => { schema => "public", }, # directory with postgis.sql and spatial_ref_sys.sql postgis_base => '/usr/local/share/postgresql/contrib' }, );
Postgres driver for Module::Build::Database.
All of the options above may be changed via the Module::Build option handling, e.g.
perl Build.PL --database_options name=my_name perl Build.PL --postgis_base=/usr/local/share/postgresql/contrib
The options are as follows ;
name : the name of the database (i.e. 'create database $name') schema : the name of the schema to be managed by MBD append_to_conf : extra options to append to postgresql.conf before starting test instances of postgres after_create : extra SQL to run after running a 'create database' statement. Note that this will be run in several different situations : 1. during a ./Build test (creating a test db) 2. during a ./Build dbfakeinstall (also creating a test db) 3. during an initial ./Build install; when the target database does not yet exist.
An example of using the after_create statement would be to create a second schema which will not be managed by MBD, but on which the MBD-managed schema depends.
The environment variables understood by psql: PGUSER, PGHOST and PGPORT will be used when connecting to a live database (for install and fakeinstall). PGDATABASE will be ignored; the name of the database should be specified in Build.PL instead.
psql
PGUSER
PGHOST
PGPORT
install
fakeinstall
PGDATABASE
To install Module::Build::Database, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Module::Build::Database
CPAN shell
perl -MCPAN -e shell install Module::Build::Database
For more information on module installation, please visit the detailed CPAN module installation guide.