[Bioperl-l] Fwd: Perl program blowing up in IO.pm

Hilmar Lapp hlapp at gmx.net
Tue Apr 8 02:41:00 EDT 2003


Marc, I'm forwarding to the bioperl list. I believe what you report may 
be a known problem and has been described previously, I seem to recall 
Jason (?) fixed it on the main trunk. You may want to search the 
mailing list.

(BTW many people may have contributed to the code in a module other 
than the person who created the module; in the case at hand I didn't 
write a single line of that snippet :-)

	-hilmar

Begin forwarded message:

> From: "Marc Perrone" <mperrone at wi.rr.com>
> Date: Sun Apr 6, 2003  7:53:22  PM US/Pacific
> To: <hlapp at gmx.net>
> Subject: Perl program blowing up in IO.pm
>
> Hi Hilmar,
>
> I'm working on a Bioinformatics project for school and I'm using 
> BioPerl.
> My program runs through a large number of sequence pairs stored in a 
> local
> FASTA file.  For each pair, it does an alignment using Standalone Blast
> (bl2seq), then does a Blast search against a local Blast database, 
> again
> using Standalone Blast, for each of the two sequences in turn.
>
> The program runs fine on small datasets, but on a larger set, after 537
> sequence pairs I get the following error:
>
> 		Error in tempfile() using C:\WINNT\TEMP\XXXXXXXXXX: Could
> not create temp file C:\WINNT\TEMP\fTgO7KEJ2F:  at D:/Perl/sit
> 		e/lib/Bio/Root/IO.pm line 614
>
> I'm pretty new to Perl so I'm not sure how to get a full stack trace 
> for the
> point at which the error occurs.  I'm looking into this and will send 
> you
> one if I can.
>
> I'm running release 1.2 of BioPerl on a Windows 2000 machine.  I have 
> plenty
> of disk space on both the C: and D: volumes.  Any idea what the problem
> might be?  Are there known file locking/release issues with temp files 
> in
> Win32 for BioPerl?  Here is the relevant code from your module, as 
> found on
> my machine.  Any help you could provide would be greatly appreciated!
>
> 			sub tempfile {
> 			    my ($self, @args) = @_;
> 			    my ($tfh, $file);
> 			    my %params = @args;
>
> 			    # map between naming with and without dash
> 			    foreach my $key (keys(%params)) {
> 				if( $key =~ /^-/  ) {
> 				    my $v = $params{$key};
> 				    delete $params{$key};
> 				    $params{uc(substr($key,1))} = $v;
> 				} else {
> 				    # this is to upper case
> 				    my $v = $params{$key};
> 				    delete $params{$key};	
> 				    $params{uc($key)} = $v;
> 				}
> 			    }
> 			    $params{'DIR'} = $TEMPDIR if(!
> exists($params{'DIR'}));
> 			    unless (exists $params{'UNLINK'} &&
> 				    defined $params{'UNLINK'} &&
> 				    ! $params{'UNLINK'} ) {
> 				$params{'UNLINK'} = 1;
> 			    } else { $params{'UNLINK'} = 0 }
> 				
> 			    if($FILETEMPLOADED) {
> 				if(exists($params{'TEMPLATE'})) {
> 				    my $template = $params{'TEMPLATE'};
> 				    delete $params{'TEMPLATE'};
> 				    ($tfh, $file) =
> File::Temp::tempfile($template, %params);
> 				} else {
> 				    ($tfh, $file) =
> File::Temp::tempfile(%params);  <---- line where error occurred
> 				}
> 			    } else {
> 				my $dir = $params{'DIR'};
> 				$file = $self->catfile($dir,
> 	
> (exists($params{'TEMPLATE'}) ?
> 							$params{'TEMPLATE'}
> :
> 							sprintf( "%s.%s.%s",
>
> 								 $ENV{USER}
> || 'unknown', $$,
> 	
> $TEMPCOUNTER++)));
>
> 				# sneakiness for getting around long
> filenames on Win32?
> 				if( $HAS_WIN32 ) {
> 				    $file = Win32::GetShortPathName($file);
> 				}
>
> 				# taken from File::Temp
> 				if ($] < 5.006) {
> 				    $tfh = &Symbol::gensym;
> 				}
> 				# Try to make sure this will be marked
> close-on-exec
> 				# XXX: Win32 doesn't respect this, nor the
> proper fcntl,
> 				#      but may have O_NOINHERIT. This may or
> may not be in Fcntl.
> 				local $^F = 2;
> 				# Store callers umask
> 				my $umask = umask();
> 				# Set a known umaskr
> 				umask(066);
> 				# Attempt to open the file
> 				if ( sysopen($tfh, $file, $OPENFLAGS, 0600)
> ) {
> 				    # Reset umask
> 				    umask($umask);
> 				} else {
> 				    $self->throw("Could not open tempfile
> $file: $!\n");
> 				}
> 			    }
>
> 			    if(  $params{'UNLINK'} ) {
> 				push @{$self->{'_rootio_tempfiles'}}, $file;
> 			    }
>
>
> 			    return wantarray ? ($tfh,$file) : $tfh;
> 			}
>
> --mvp
>
> Marc Perrone
> mperrone at wi.rr.com
> 414/332-7577 (h)
> 414/403-7578 (cell)
> 414/524-5580 (w)
>

-- 
-------------------------------------------------------------
Hilmar Lapp                            email: lapp at gnf.org
GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
-------------------------------------------------------------



More information about the Bioperl-l mailing list