$database = "foo"; require '/home/share/jdb.cgi'; # now I can do whatever with $dbh.. #### use DBI; my ($package, $filename) = caller; #my ($dsn); # if it's the dev site, return the Dev DSN, otherwise, return # the production DSN. if ($filename =~ /sites-dev/) { # it's the dev site $dsn = "DBI:mysql:database=$database;port=3308"; } else { # it's the production site $dsn = "DBI:mysql:database=$database;port=3306"; } $dbh = DBI->connect($dsn, "perlscript", "passboy"); 1;