What actually happens?
What did the error log say?
Code looks like it would do the job if the current directory is writable, but its probably cgi-bin so its not writeable by user "apache"
See CGI::Carp and CGI Help Guide, Troubleshooting Perl CGI scripts.. cgi101
Code could always use some polishing
#!/usr/bin/perl -T -- use strict; use warnings; use CGI (); use CGI::Carp qw( fatalsToBrowser ); my $query = CGI->new; my $id = $query->param( 'participant_id' ); $id =~ s/[^a-z0-9]//g; ## remove not word $id = $1 if $id =~ m{([a-z0-9]+)}; ## untaint $id or die "no valid id"; ## "/usr/home/roshambo/csvlogs/participant_". my $filename = "participant_".$id."_data.csv"; open my($outfh), '>>', $filename or die $!, "Couldn\'t open outfile fo +r reading!\n"; print $outfh 'pause_time'."\t", $query->param('pause_time'), "\n"; $query->delete('pause_time', 'particpant_id'); for my $key ( $query->param ){ print $outfh $key."\t", $query->param($key), "\n"; } close $outfh; print $query->header; print "You are participant $id!"; exit( 0 );
In reply to Re: CGI script to output data as CSV
by Anonymous Monk
in thread CGI script to output data as CSV
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |