[Bioperl-l] tempfiles/tempdirs
Lincoln Stein
lstein@cshl.org
Mon, 21 Jan 2002 08:11:27 -0500
My suggestion would be to replace the Root tempfile method with a call
to IO::File->new_tempfile, thereby preserving the published API. The
IO::File call is well-tested and works on all platforms.
Lincoln
Jason Stajich writes:
> I've been looking through the code to see where we use the Root::IO
> methods, tempfile and tempdir - not a whole lot. I am concerned because
> we seem to be leaving some clutter after running tests and File::Temp
> files are not necessarily removed when the filehandle closes. This can be
> a problem for people running CGI's or many many analyses within a single
> perl session.
>
> It seems to me that the IO::File way of doing tempfiles
>
> my $fh = IO::File->new_tempfile
>
> might be more sane. This is r/w capable handle so after writing to it -
> we can rewind th fh and access what has been written. This is essentially
> the behavior needed by some of the parsers.
>
> We do need unique tempfile names to be output for executing programs and
> IO::File provides the methods tmpnam() to achieve this. I would like to
> be able to rely on IO::File being installed (which it appears to be even
> on perl 5.004_04). you do have to test that tmpnam returns something
> valid by doing
> do { $name = tmpnam() } until sysopen(TMP, $name, .... );
> while File::Temp assures that your temporary name is valid.
>
> Does anyone have opinions here? I like the filehandle method better. And
> I think we can be creative in our tempname generation in the modules that
> need it.
>
> -jason
>
> --
> Jason Stajich
> Duke University
> jason@cgt.mc.duke.edu
>
>
>
>
>
>
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
--
========================================================================
Lincoln D. Stein Cold Spring Harbor Laboratory
lstein@cshl.org Cold Spring Harbor, NY
Positions available at my lab: see http://stein.cshl.org/#hire
========================================================================