[Bio] / Clearinghouse / ch_database.pm Repository:
ViewVC logotype

View of /Clearinghouse/ch_database.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Mon May 2 21:31:43 2005 UTC (14 years, 5 months ago) by olson
Branch: MAIN
CVS Tags: myrast_33, HEAD
Changes since 1.1: +8 -1 lines
Factor some stuff out to utils.pm
Misc cleanup.
add 1-SUBSYSTEM type.

#
# Common database initialization package.
#

use strict;
use base 'Exporter';

our @EXPORT = qw(db_init);

use DBrtns;
use CH_Config;
use FIG_Config;

my $cached_db;

#
# Set up defaults in CH_Config from FIG_Config.
#
for my $var (qw(dbms db dbuser dbpass dbport))
{
    #
    # See "man perlmod" in the section "Symbol Tables" for why this works.
    #
    if (not exists($CH_Config::{$var}))
    {
	$CH_Config::{$var} = $FIG_Config::{$var};
    }
}

sub db_init
{
    if (!defined($cached_db))
    {
	$cached_db = new DBrtns($CH_Config::dbms, $CH_Config::db,
				$CH_Config::dbuser, $CH_Config::dbpass, $CH_Config::dbport);
    }
    return $cached_db;
}
   

1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3