Hi,
Problem: I want the $USER to have the possibility to download the data that
is displayed (using H::T) in his browser to a file in his own directory.
Without the fancy HTML formatting. I'm talking about tables with numbers
obtained from a MySQL database.
Purpose: data download to, eg. M$ Excel, for further manipulation.
Precondition: I'd really like to reuse the same datastructures I now send to
H::T.
Possible solutions:
(1) Always save each query output also to file on the webserver (with a
unique ID) using a dedicated 'ASCII' template and $template->ouput(print_to
=> *STDOUT) and then provide the $USER with a d/l link for that unique file.
Instead of table formatting I'd use CSV formatting.
Pro: relatively easy to do
Con: pollution of the webserver: need to remove 'stale' files
(2) Don't use H::T and instead make separate subroutines for each dataset.
Downloading them to the user with something like this:
print $query->header('-type'=>'application/octet-stream');
open (FILE, "<${docdir}/${file_name}") or fatal_error("$!\n");
foreach (@lines_of_formatted_data) {
print FILE "$_\n";
}
close (FILE);
(3) Use a CPAN module someone else wrote but which is as yet unknown to me.
Your input is much appreciated.
Martijn
--
+----------------------------------+
Martijn van den Burg
ASML, CS PPC Inform@tion Systems
Voice: +31 (0)40 268 3856
+----------------------------------+
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]