Skip to content
Browse files

Use 'exists', not 'defined', to check for existence of hash entry

  • Loading branch information...
1 parent 0652de5 commit 8d7a3ccf3e496c5820c86e5a4255c57db488d4a1 @fangly fangly committed
Showing with 4 additions and 9 deletions.
  1. +4 −9 Bio/Search/Hit/ModelHit.pm
View
13 Bio/Search/Hit/ModelHit.pm
@@ -323,8 +323,8 @@ See documentation in L<Bio::Search::Hit::HitI::overlap()|Bio::Search::Hit::HitI>
sub overlap {
my $self = shift;
- if(@_) { $self->{'_overlap'} = shift; }
- defined $self->{'_overlap'} ? $self->{'_overlap'} : 0;
+ $self->{'_overlap'} = shift if @_;
+ return exists $self->{'_overlap'} ? $self->{'_overlap'} : 0;
}
@@ -351,16 +351,11 @@ See Also : L<num_hsps()|num_hsps>
sub n {
my $self = shift;
-
$self->{'_n'} = shift if @_;
-
- if (defined $self->{'_n'}) {
- return $self->{'_n'}
- } else {
- return $self->num_hsps;
- }
+ return exists $self->{'_n'} ? $self->{'_n'} : $self->num_hsps;
}
+
=head2 p
Usage : $hit_object->p( [format] );

0 comments on commit 8d7a3cc

Please sign in to comment.
Something went wrong with that request. Please try again.