[VPM] comments on this code?

nkuipers nkuipers at uvic.ca
Tue Apr 1 17:45:22 CST 2003


Hello again,

I wrote earlier about using Perl to automate a script's recovery from 
server-side troubles (the machine I am thinking of tends to crap out more than 
the others, and needs to be rebooted).  Peter directed me to perlipc, and from 
reading about pipes and the like, I came up with the following.  Please let me 
know if I am doing anything BAD BAD BAD...

sub blast {
my $data = shift;
my $temp = "$ENV{HOME}/temp/seq.tmp";
my $fifo = "ssh snoopy.ceh.uvic.ca /usr/local/bin/blastall";
my @args = ('-p blastn', '-d nt', '-e 0.0000001', '-m 7');

### load input file with fasta-formatted queryid/sequence ###
open  SEQ, ">$temp" or die "Could not open for write:$!";
print SEQ  ">",$data->[0],"\n",$data->[1];	
close SEQ;

### open a handle to BLAST output, retry if unsuccessful for any reason ###
{
	if (!open BLAST, "$fifo @args <$temp|") {
		#
		print LOG "BLAST connection refused, retrying...\n";
		#
		sleep(300);
		redo;
	}
}

### process the report ###
parse(*BLAST);
}




More information about the Victoria-pm mailing list