**debug, form data param{",$key, "}=", $param{$key}, "\n
") if $debug eq 'yes'; $param{$key} =~ s/ /_/g ; $param{$key} =~ s/\n/_!n!_/g ; $param{$key} =~ s/\t/_/g ; $param{$key} =~ s/\r/_!r!_/g ; $all_data = $all_data . "\t" . $key . "=" . $param{$key}; $export = $param{$key}; $export =~ s/_/ /g; $export =~ s/!n!/|/g; $all_data_export = $all_data_export . "\n" . $key . "=" . $export; } $all_data =~ s/^\s//g; $all_data_export =~ s/^\s//g; $all_data =~ s/\%0D/ /g; $all_data_export =~ s/\%0D/ /g; $all_data =~ s/%0D/ /g; $all_data_export =~ s/%0D/ /g; $all_data =~ s/\%0A/ /g; $all_data_export =~ s/\%0A/ /g; $all_data =~ s/%0A/ /g; $all_data_export =~ s/%0A/ /g; $all_data_export =~ s/ {2,}/ /g; print STDOUT ("
**debug, form all_data=$all_data
\n") if $debug eq 'yes'; #Make copies of all files $unique=`date +%Y%b%d_%I%M%S`; chomp $unique; $backupreg="$backup_area/UNOLS_evaluation_form.$unique"; @args = ("cp", "$response_data_file", "$backupreg"); unless (system(@args) == 0 ) { print STDOUT "
Could not backup up response file, error=$?\n"; &sendmessage($error,"Could not backup up response file", "args=@args, error=$?"); print STDOUT ( "
NEXT1 #Add mail as backup to collections form file $mailfile="/tmp/mail_tmp.$unique"; if (open MAIL, ">$mailfile") { print MAIL ("$all_data_export\n"); close MAIL; foreach $email_address (@email_address_to_get_data) { `/bin/mail -s \"UNOLS Performance Evaluation" $email_address <$mailfile`; } unlink $mailfile; } else { &sendmessage ($error,"Could not write temporary mail file", "file=$mailfile, error=$!"); print STDOUT ("
debug, writing to response data file=$response_data_file
")
if $debug eq 'yes';
if (open REG, ">>$response_data_file") {
print REG ("$all_data\n");
close REG;
}
else {
&sendmessage ($error,"Could not append to response data file",
"file=$response_data_file, error=$!");
print STDOUT ("
Thanks for completing the form.", '
'); END_OF_PROGRAM: print STDOUT ("