NAME
App::Dochazka::REST::ConnBank - Provide DBIx::Connector objects
SYNOPSIS
use App::Dochazka::REST::ConnBank qw( $dbix_conn conn_status );
$dbix_conn->run( fixup => sub {
...
} );
print "Database connection status: " . conn_status() . "\n";
# construct an arbitrary DBIx::Connector object
my $conn = App::Dochazka::REST::ConnBank::get_arbitrary_dbix_conn(
'mydb', 'myuser', 'mypass'
);
DESCRIPTION
This module contains routines relating to DBIx::Connector. Mostly, the application uses the $dbix_conn
singleton.
EXPORTS
PACKAGE VARIABLES
This module stores the DBIx::Connector singleton object that is imported by all modules that need to communicate with the database.
FUNCTIONS
get_arbitrary_dbix_conn
Wrapper for DBIx::Connector->new. Takes database name, database user and password. Returns a DBIx::Connector object (even if the database is unreachable).
init_singleton
Initialize the $dbix_conn
singleton using dbname, dbuser, and dbpass values from site configuration. Also set the PGTZ environment variable to the value of the DOCHAZKA_TIMEZONE config param.
Idempotent.
conn_up
Given a DBIx::Connector object, call ping on the associated database handle and return true or false based on the result.
If no argument is given, returns the status of the $dbix_conn
singleton.
conn_status
Given a DBIx::Connector object, call ping on the associated database handle and return either 'UP' or 'DOWN' based on the result.
If no argument is given, returns the status of the $dbix_conn
singleton.