##
var submitted = false;
function SubmitTheCSVForm() {
if(submitted == true) { return; }
document.csvform.csv.value = 'working...';
document.csvform.csv.disabled = true;
submitted = true;
document.csvform.submit();
}
##
##
sub downloadcsv : Runmode {
my $self = shift;
if (my $pid = fork) {
# parent does this
return $self->redirect("/myapp.pl/csv_status");
} elsif (defined $pid) {
# child does this
close STDOUT;
close STDERR;
open STDERR, ">&=1";
my $id = $self->session->id();
my $cmd = "$CFG{'PATH'}/make_csv.pl";
exec "$cmd", "$id";
die "can't do exec: $!";
} else {
die "cannot fork: $!";
}
}
##
##
sub csv_status : Runmode {
my $self = shift;
my $id = $self->session->id();
my $path = $CFG{'CSV_TEMP'};
my $still_running = 0;
if ( -e "$path/$id/csv.pid" ) {
open my $in, '<', "$path/$user/csv.pid" or die
"can't access $user/csv.pid file : $!";
my $pid = <$in>;
close $in;
if ( IsStillRunning($pid) ) {
$still_running = 1;
} else {
$still_running = 0;
}
}
my $template = $self->load_tmpl('csv_status.html');
$template->param(
TITLE => "CSV Status",
STILL_RUNNING => $still_running,,
);
return $template->output;
}
##
##
...
Please be patient... this might take a while.
Job complete!