[Bioperl-l] Fwd: [Bioperl-guts-l] [15178] bioperl-live/trunk: new test method test_output_dir(), a wrapper around Temp::File::tempdir

Chris Fields cjfields at illinois.edu
Tue Dec 16 17:59:18 UTC 2008


We probably could add it in unversioned just in case as a 'requires'  
but it shouldn't pop up.  We require perl 5.6.1 and above, and  
File::Temp is listed as part of the perl core for those versions.

I agree, I think it makes sense to consolidate any bioperl temp file  
creation in Root::IO on File::Temp.  In fact, I would expand that to  
say just about any IO in BioPerl beyond DB connectivity should be  
going through Bio::Root::IO for consistency.

chris

On Dec 16, 2008, at 11:19 AM, Jason Stajich wrote:

> Bio::Root::IO already had a tempdir function which did some  
> workarounds if File::Temp wasn't installed.
> I guess we assume File::Temp is installed as an essential module now  
> then to install (in order to run tests)?
>
> Does it make sense to consolidate and depend on File::Temp aspects?
>
> -jason
> Begin forwarded message:
>
>> From: Senduran  Balasubramaniam <sendu at dev.open-bio.org>
>> Date: December 16, 2008 4:48:22 AM PST
>> To: bioperl-guts-l at bioperl.org
>> Subject: [Bioperl-guts-l] [15178] bioperl-live/trunk: new test  
>> method test_output_dir(), a wrapper around Temp::File::tempdir
>>
>> Revision: 15178
>> Author:   sendu
>> Date:     2008-12-16 07:48:21 -0500 (Tue, 16 Dec 2008)
>>
>> Log Message:
>> -----------
>> new test method test_output_dir(), a wrapper around  
>> Temp::File::tempdir
>>
>> Modified Paths:
>> --------------
>>   bioperl-live/trunk/Bio/Root/Test.pm
>>   bioperl-live/trunk/t/LocalDB/DBFasta.t
>>   bioperl-live/trunk/t/LocalDB/DBQual.t
>>   bioperl-live/trunk/t/LocalDB/Flat.t
>>   bioperl-live/trunk/t/RemoteDB/Taxonomy.t
>>
>> Modified: bioperl-live/trunk/Bio/Root/Test.pm
>> ===================================================================
>> --- bioperl-live/trunk/Bio/Root/Test.pm	2008-12-16 07:49:26 UTC  
>> (rev 15177)
>> +++ bioperl-live/trunk/Bio/Root/Test.pm	2008-12-16 12:48:21 UTC  
>> (rev 15178)
>> @@ -51,6 +51,10 @@
>>  # deleted when the test script finishes
>>  my $output_file = test_output_file();
>>
>> +  # we want the name of a directory we can store files in, that  
>> will be
>> +  # automatically deleted when the test script finishes
>> +  my $output_dir = test_output_dir();
>> +
>> =head1 DESCRIPTION
>>
>> This provides a common base for all Bioperl test scripts. It safely  
>> handles the
>> @@ -104,7 +108,7 @@
>> use strict;
>> use warnings;
>>
>> -use File::Temp ();
>> +use File::Temp qw(tempdir);
>> use File::Spec;
>> use Exporter qw(import);
>>
>> @@ -159,6 +163,7 @@
>>                 test_begin
>>                 test_skip
>>                 test_output_file
>> +                 test_output_dir
>>                 test_input_file
>>                 test_network
>>                 test_debug);
>> @@ -292,6 +297,25 @@
>>    return $tmp->filename;
>> }
>>
>> +=head2 test_output_dir
>> +
>> + Title   : test_output_dir
>> + Usage   : my $output_dir = test_output_dir();
>> + Function: Get the full path of a directory suitable for storing  
>> temporary files
>> +           in.
>> +           When your test script ends, the directory and its  
>> contents will be
>> +           automatically deleted.
>> + Returns : string (path)
>> + Args    : none
>> +
>> +=cut
>> +
>> +sub test_output_dir {
>> +    die "test_output_dir takes no args\n" if @_;
>> +
>> +    return tempdir(CLEANUP => 1);
>> +}
>> +
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l




More information about the Bioperl-l mailing list