use Run qw(check);
sub path {
- my ($self, $path) = @_;
- if (defined $path) { $self->{path}= $path }
- else {
- if (defined $self->{path}) { return $self->{path} }
- else { croak "Path not defined" }
- }
+ my ( $self, $path ) = @_;
+ if ( defined $path ) { $self->{path} = $path }
+ else {
+ if ( defined $self->{path} ) { return $self->{path} }
+ else { croak "Path not defined" }
+ }
}
sub run {
- my ($self, $fasta) = @_;
+ my ( $self, $fasta ) = @_;
- croak "Non FASTA::File object passed to Pairwise::run" unless isa $fasta, 'FASTA::File';
+ croak "Non FASTA::File object passed to Pairwise::run" unless isa $fasta, 'FASTA::File';
- local ($/, $?) = (undef, 0);
+ local ( $/, $? ) = ( undef, 0 );
- my $f = File::Temp->new->filename;
- $fasta->write_file($f);
+ my $f = File::Temp->new->filename;
+ $fasta->write_file($f);
- my $pid = open my $fh, $self->path." $f |" or die $!;
+ my $pid = open my $fh, $self->path . " $f |" or die $!;
- my @output = join "\n", split "\n", <$fh>;
+ my @output = join "\n", split "\n", <$fh>;
- waitpid $pid, 0;
- check($self->path, $?) or die "Pairwise was naughty\n";
+ waitpid $pid, 0;
+ check( $self->path, $? ) or die "Pairwise was naughty\n";
- return @output;
+ return @output;
}
1;