@@ -185,7 +185,7 @@ sub breeder_download : Path('/breeders/download/') Args(0) {
185
185
sub _parse_list_from_json {
186
186
my $list_json = shift ;
187
187
# print STDERR "LIST JSON: ". Dumper $list_json;
188
- my $json = new JSON;
188
+ my $json = JSON-> new() ;
189
189
if ($list_json ) {
190
190
# my $decoded_list = $json->allow_nonref->relaxed->escape_slash->loose->allow_singlequote->allow_barekey->decode($list_json);
191
191
my $decoded_list = decode_json($list_json );
@@ -634,26 +634,26 @@ sub download_action : Path('/breeders/download_action') Args(0) {
634
634
if ($format eq " .csv" ) {
635
635
636
636
# build csv with column names
637
- open (CSV , " > :encoding(UTF-8)" , $tempfile ) || die " Can't open file $tempfile \n " ;
637
+ open (my $csv_fh , " > :encoding(UTF-8)" , $tempfile ) || die " Can't open file $tempfile \n " ;
638
638
my @header = @{$data [0]};
639
639
my $num_col = scalar (@header );
640
640
for (my $line =0; $line < @data ; $line ++) {
641
641
my @columns = @{$data [$line ]};
642
642
my $step = 1;
643
643
for (my $i =0; $i <$num_col ; $i ++) {
644
644
if (defined ($columns [$i ])) {
645
- print CSV " \" $columns [$i ]\" " ;
645
+ print $csv_fh " \" $columns [$i ]\" " ;
646
646
} else {
647
- print CSV " \"\" " ;
647
+ print $csv_fh " \"\" " ;
648
648
}
649
649
if ($step < $num_col ) {
650
- print CSV " ," ;
650
+ print $csv_fh " ," ;
651
651
}
652
652
$step ++;
653
653
}
654
- print CSV " \n " ;
654
+ print $csv_fh " \n " ;
655
655
}
656
- close CSV ;
656
+ close $csv_fh ;
657
657
658
658
} else {
659
659
my $ss = Excel::Writer::XLSX-> new($tempfile );
@@ -769,7 +769,7 @@ sub download_accession_properties_action : Path('/breeders/download_accession_pr
769
769
my $file_name = basename($file_path );
770
770
771
771
# Write to csv file
772
- open (CSV , " > :encoding(UTF-8)" , $file_path ) || die " Can't open file $file_path \n " ;
772
+ open (my $csv_fh , " > :encoding(UTF-8)" , $file_path ) || die " Can't open file $file_path \n " ;
773
773
my @header = @{$rows -> [0]};
774
774
my $num_col = scalar (@header );
775
775
@@ -778,18 +778,18 @@ sub download_accession_properties_action : Path('/breeders/download_accession_pr
778
778
my $step = 1;
779
779
for ( my $i = 0; $i < $num_col ; $i ++ ) {
780
780
if ($columns -> [$i ]) {
781
- print CSV " \" $columns ->[$i ]\" " ;
781
+ print $csv_fh " \" $columns ->[$i ]\" " ;
782
782
} else {
783
- print CSV " \"\" " ;
783
+ print $csv_fh " \"\" " ;
784
784
}
785
785
if ($step < $num_col ) {
786
- print CSV " ," ;
786
+ print $csv_fh " ," ;
787
787
}
788
788
$step ++;
789
789
}
790
- print CSV " \n " ;
790
+ print $csv_fh " \n " ;
791
791
}
792
- close CSV ;
792
+ close $csv_fh ;
793
793
794
794
# Return the csv file
795
795
$c -> res-> content_type(' text/csv' );
0 commit comments