[Bioperl-l] Bio::Object

Jason Stajich jason@chg.mc.duke.edu
Fri, 8 Dec 2000 11:52:43 -0500 (EST)


I was thinking, as I am starting to use the temp dir for code in
(Bio::Seq;:LargePrimarySeq, Bio::DB::WebSeqDBI ), maybe it would make
sense to have a tempdir routine in Bio::Root::RootI or some sort of
Bio::Root::Util (depending on how we decide to clean things up).

This would be set in a BEGIN block with the code looking something like
this

eval { 
    $TEMPDIR = File::Spec->tmpdir();
};
if( $@ || !defined $TEMPDIR || $TEMPDIR eq '' ) {
    if( defined $ENV{'TMPDIR'} ) { $TEMPDIR = $ENV{'TMPDIR'}  }
    elsif( defined $ENV{'TEMPDIR'} ) { $TEMPDIR = $ENV{'TEMPDIR'} }
    elsif(-w '/tmp') { $TEMPDIR = '/tmp' }
    else { $TEMPDIR = "."; }
} 
# in initialize we would initialize this
sub _initialize {
  $self->tmpdir($TEMPDIR);
}

I'd also like to be able to have a tempfilename generator - we could use
the File::Temp or File::MkTemp modules or write our own routine in RootI.
Just would be important to have a standardization.

How does this sound?

-Jason

Jason Stajich
jason@chg.mc.duke.edu
Center for Human Genetics
Duke University Medical Center 
http://www.chg.mc.duke.edu/