Commit 6765ee11 authored by Tiago Grego's avatar Tiago Grego
Browse files

do not return undef, just return

parent 7ce07f86
......@@ -101,7 +101,7 @@ sub munge_chr_id {
my $bam = $self->bam_open;
warn "Failed to open BAM file " . $self->url unless $bam;
return undef unless $bam;
return unless $bam;
my $header = $bam->header;
......@@ -130,7 +130,7 @@ sub munge_chr_id {
}
warn " *** could not parse_region for BAM with $chr_id in file " . $self->url ."\n";
return undef;
return;
}
sub fetch_paired_alignments {
......
......@@ -130,7 +130,7 @@ sub munge_chr_id {
warn "Failed to open BigBed file " . $self->url unless $bb;
return undef unless $bb;
return unless $bb;
my $list = $bb->chromList;
my $head = $list->head;
......
......@@ -77,7 +77,7 @@ sub munge_chr_id {
warn "Failed to open BigWig file " . $self->url unless $bw;
return undef unless $bw;
return unless $bw;
my $list = $bw->chromList;
my $head = $list->head;
......
......@@ -107,7 +107,7 @@ sub munge_chr_id {
}
warn " *** could not parse_region for BAM/CRAM with $chr_id in file " . $self->url ."\n";
return undef;
return;
}
sub fetch_paired_alignments {
......
......@@ -312,7 +312,7 @@ sub validate_metadata {
## TODO - implement validation!
}
return undef;
return;
}
=head2 validate_record
......
......@@ -57,9 +57,9 @@ sub open {
## This format has no metadata
sub is_metadata { return undef; }
sub is_metadata { return; }
sub read_metadata { return undef; }
sub read_metadata { return; }
=head2 read_record
......
......@@ -619,7 +619,7 @@ sub get_info_description {
sub get_raw_formats {
my $self = shift;
return undef if (!$self->get_metadata_by_pragma('header')->[8] || $self->get_metadata_by_pragma('header')->[8] ne 'FORMAT');
return if (!$self->get_metadata_by_pragma('header')->[8] || $self->get_metadata_by_pragma('header')->[8] ne 'FORMAT');
return $self->{'record'}[8];
}
......@@ -667,14 +667,14 @@ sub get_metadata_description {
if (!defined($type) || !defined($id)) {
carp("You need to provide a meta type (e.g. 'INFO') and a meta entry ID (e.g. 'AA')");
return undef;
return;
}
my $meta = $self->get_metadata_by_pragma($type);
foreach my $meta_entry (@$meta) {
return $meta_entry->{'Description'} if ($meta_entry->{'ID'} eq $id);
}
return undef;
return;
}
......
......@@ -60,9 +60,9 @@ sub open {
## This format has no metadata
sub is_metadata { return undef; }
sub is_metadata { return; }
sub read_metadata { return undef; }
sub read_metadata { return; }
=head2 set_fields
......
......@@ -58,9 +58,9 @@ sub open {
## This format has no metadata
sub is_metadata { return undef; }
sub is_metadata { return; }
sub read_metadata { return undef; }
sub read_metadata { return; }
=head2 set_fields
......
......@@ -62,7 +62,7 @@ sub is_metadata {
sub read_metadata {
### No useful metadata, just column names
return undef;
return;
}
=head2 set_fields
......
......@@ -274,7 +274,7 @@ sub get_score {
my $self = shift;
my $val = $self->get_raw_score();
if ($val && $val =~ /^\.$/) {
return undef;
return;
} else {
return $val;
}
......
......@@ -168,7 +168,7 @@ sub get_field {
}
# If the field doesn't exist, return undef
return undef;
return;
}
=head2 batch_fields
......@@ -230,7 +230,7 @@ sub fetch_callback {
}
# If the field doesn't exist, return undef
return undef
return;
}
1;
......@@ -283,7 +283,7 @@ sub sv_cipos {
return "$info=$cipos";
} else {
return undef;
return;
}
}
......@@ -300,7 +300,7 @@ sub sv_ciend {
return "$info=$ciend";
} else {
return undef;
return;
}
}
......@@ -312,7 +312,7 @@ sub sv_imprecise {
if (($object->outer_start && $object->inner_start) || ($object->inner_end && $object->outer_end)) {
return $info;
} else {
return undef;
return;
}
}
......
......@@ -50,7 +50,7 @@ sub sanitise_path {
}
}
else {
return undef;
return;
}
}
......@@ -127,7 +127,7 @@ sub get_compression {
return 'gz' if $file =~ /\.gz$/;
return 'zip' if $file =~ /\.zip$/;
return 'bz' if $file =~ /\.bz2?$/;
return undef;
return;
}
}
......
......@@ -43,7 +43,7 @@ sub create_path {
my @directories = make_path($path, { %$params, 'error' => \my $error });
if (@$error) {
return undef if $no_exception;
return if $no_exception;
throw(sprintf qq(Could not create the given path '%s' due to following errors: \n%s), $path, displayable_error($error));
}
......@@ -62,7 +62,7 @@ sub remove_directory {
my $file_count = remove_tree($path, { %$params, 'error' => \my $error});
if (@$error) {
return undef if $no_exception;
return if $no_exception;
throw(sprintf qq(Could not remove the given directory '%s' due to following errors: \n%s), $path, displayable_error($error));
}
......@@ -111,14 +111,14 @@ sub copy_dir_contents {
my $no_exception = delete $params->{'no_exception'};
my $contents = [];
my %exclude = map { $_ =~ s/\/$//r => 1 } @{$params->{'exclude'} || []};
my $dir_contents = list_dir_contents($source_dir, {'no_exception' => $no_exception}) or return undef;
my $dir_contents = list_dir_contents($source_dir, {'no_exception' => $no_exception}) or return;
if (!-d $dest_dir) {
if ($params->{'create_path'}) {
push @$contents, @{ create_path($dest_dir) };
} else {
throw("Destination directory $dest_dir does not exist.") unless $no_exception;
return undef;
return;
}
}
......@@ -188,7 +188,7 @@ sub list_dir_contents {
if (!$dh) {
throw("An error occurred while reading the directory $dir: $!") unless $params->{'no_exception'};
return undef;
return;
}
while (my $content = $dh->read) {
......
......@@ -191,7 +191,7 @@ sub fetch_file {
else {
if ($@) {
throw(sprintf qq(Could not fetch contents of file '%s' due to following errors: \n%s), $path, $@) unless $args->{'no_exception'};
return undef;
return;
}
else {
return $content;
......@@ -237,7 +237,7 @@ sub read_file {
else {
if ($@) {
throw(sprintf qq(Could not read file '%s' due to following errors: \n%s), $path, $@) unless $args->{'no_exception'};
return undef;
return;
}
else {
return $content;
......@@ -285,7 +285,7 @@ sub read_lines {
else {
if ($@) {
throw(sprintf qq(Could not read lines from file '%s' due to following errors: \n%s), $path, $@) unless $args->{'no_exception'};
return undef;
return;
}
else {
return $content;
......@@ -347,7 +347,7 @@ sub preview_file {
else {
if ($@) {
throw(sprintf qq(Could not fetch preview of file '%s' due to following errors: \n%s), $path, $@) unless $args->{'no_exception'};
return undef;
return;
}
else {
return $lines;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment