in reply to saving data locally in CGI script?
use strict; use warnings; use CGI; my $cgi = CGI->new(); sub handle_error { print $cgi->header( -status => 500, -type => 'text/html', ); print ...; exit(0); } open(my $fh, '<', 'foo.csv') or handle error(...); print $cgi->header( # application/octet-stream might work better -type => 'text/csv', -attachment => 'foo.csv', ); print while <$fh>;
Of course, you can base the name of the CSV on a CGI parameter or on a session field. Or you can generate it on the fly instead of reading it form disk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: saving data locally in CGI script?
by Anonymous Monk on Jan 22, 2010 at 23:04 UTC | |
by ikegami (Patriarch) on Jan 22, 2010 at 23:22 UTC | |
by Anonymous Monk on Jan 22, 2010 at 23:46 UTC | |
by ikegami (Patriarch) on Jan 23, 2010 at 00:42 UTC |