Skip to content

Commit

Permalink
fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Sri-2023 committed Dec 12, 2024
1 parent 46ff305 commit f9e8593
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions lib/SGN/Controller/BreedersToolbox/Download.pm
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ sub breeder_download : Path('/breeders/download/') Args(0) {
sub _parse_list_from_json {
my $list_json = shift;
# print STDERR "LIST JSON: ". Dumper $list_json;
my $json = new JSON;
my $json = JSON->new();
if ($list_json) {
# my $decoded_list = $json->allow_nonref->relaxed->escape_slash->loose->allow_singlequote->allow_barekey->decode($list_json);
my $decoded_list = decode_json($list_json);
Expand Down Expand Up @@ -634,26 +634,26 @@ sub download_action : Path('/breeders/download_action') Args(0) {
if ($format eq ".csv") {

#build csv with column names
open(CSV, "> :encoding(UTF-8)", $tempfile) || die "Can't open file $tempfile\n";
open(my $csv_fh, "> :encoding(UTF-8)", $tempfile) || die "Can't open file $tempfile\n";
my @header = @{$data[0]};
my $num_col = scalar(@header);
for (my $line =0; $line< @data; $line++) {
my @columns = @{$data[$line]};
my $step = 1;
for(my $i=0; $i<$num_col; $i++) {
if (defined($columns[$i])) {
print CSV "\"$columns[$i]\"";
print $csv_fh "\"$columns[$i]\"";
} else {
print CSV "\"\"";
print $csv_fh "\"\"";
}
if ($step < $num_col) {
print CSV ",";
print $csv_fh ",";
}
$step++;
}
print CSV "\n";
print $csv_fh "\n";
}
close CSV;
close $csv_fh;

} else {
my $ss = Excel::Writer::XLSX->new($tempfile);
Expand Down Expand Up @@ -769,7 +769,7 @@ sub download_accession_properties_action : Path('/breeders/download_accession_pr
my $file_name = basename($file_path);

# Write to csv file
open(CSV, "> :encoding(UTF-8)", $file_path) || die "Can't open file $file_path\n";
open(my $csv_fh, "> :encoding(UTF-8)", $file_path) || die "Can't open file $file_path\n";
my @header = @{$rows->[0]};
my $num_col = scalar(@header);

Expand All @@ -778,18 +778,18 @@ sub download_accession_properties_action : Path('/breeders/download_accession_pr
my $step = 1;
for ( my $i = 0; $i < $num_col; $i++ ) {
if ($columns->[$i]) {
print CSV "\"$columns->[$i]\"";
print $csv_fh "\"$columns->[$i]\"";
} else {
print CSV "\"\"";
print $csv_fh "\"\"";
}
if ($step < $num_col) {
print CSV ",";
print $csv_fh ",";
}
$step++;
}
print CSV "\n";
print $csv_fh "\n";
}
close CSV;
close $csv_fh;

# Return the csv file
$c->res->content_type('text/csv');
Expand Down
2 changes: 1 addition & 1 deletion t/lib/SGN/Test/Fixture.pm
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ sub dbic_schema {
return $self->people_schema();
}

return undef;
return;
}

sub get_conf {
Expand Down

0 comments on commit f9e8593

Please sign in to comment.