Years ago, I was creating a suite of modules relating to the lab's Second Generation sequencing, mostly having to do with the collecting and disseminating the metadata. So I made lots of modules like SecGenTools::Accession, SecGenTools::Request, SecGenTools::CV, etc.
I was doing a lot of database calls with this, so I created a library, SecGenTools::DB, which exported three modules: db_hashref , which takes an SQL query and returns the data requested in a hash reference; db_arrayref, which takes an SQL query and returns the data requested in an array reference, and db_do, which is used for putting data into the database.
And I found that this was useful, and so, when I started making modules for other tasks, I copied it over, so we have Agilent::DB and PCR::DB.
We're in-process for moving servers, and this is leading me to bite the bullet and try to hang everything off lib/DB.pm instead, so there's one implementation. I've also set it up so that lib/DB.pm doesn't have hard-coded test-and-production
But, the institutional decision is that the libraries must work on the server-to-be-shitcanned and for our bright-and-shining future.
So, I need to write the code such that, if it exists in the old servers, it works like:
use lib '/home/foo/lib' ;
use Fmep::DB 'all' ;
if ( $params->{ 'test' } { $Fmep::DB::Database = 'test' ; }
and on the new, it works like:
use lib /group/gcore/lib ;
use DB ;
$DB::Database = "dbuser" ; # where the real dbuser is something I'm not telling you.
Except, no, there has to be a hook that tells me which system it's on, then say 'dbuser1' or 'dbuser2' depending. Of course, the system which would use 'dbuser2' doesn't exist yet.
I was doing a lot of database calls with this, so I created a library, SecGenTools::DB, which exported three modules: db_hashref , which takes an SQL query and returns the data requested in a hash reference; db_arrayref, which takes an SQL query and returns the data requested in an array reference, and db_do, which is used for putting data into the database.
And I found that this was useful, and so, when I started making modules for other tasks, I copied it over, so we have Agilent::DB and PCR::DB.
We're in-process for moving servers, and this is leading me to bite the bullet and try to hang everything off lib/DB.pm instead, so there's one implementation. I've also set it up so that lib/DB.pm doesn't have hard-coded test-and-production
But, the institutional decision is that the libraries must work on the server-to-be-shitcanned and for our bright-and-shining future.
So, I need to write the code such that, if it exists in the old servers, it works like:
use lib '/home/foo/lib' ;
use Fmep::DB 'all' ;
if ( $params->{ 'test' } { $Fmep::DB::Database = 'test' ; }
and on the new, it works like:
use lib /group/gcore/lib ;
use DB ;
$DB::Database = "dbuser" ; # where the real dbuser is something I'm not telling you.
Except, no, there has to be a hook that tells me which system it's on, then say 'dbuser1' or 'dbuser2' depending. Of course, the system which would use 'dbuser2' doesn't exist yet.
No comments:
Post a Comment