|Perl: the Markov chain saw|
Re: Re: Re: capturing STDOUTby jmcnamara (Monsignor)
|on May 02, 2001 at 03:25 UTC||Need Help??|
The example that you posted has been updated in more recent versions of the module to highlight these options. However, the view or save options can be overridden by the client browser.
Can you comment on your tie soln above, and the alternative as per cgi.pl?
In a CGI program you have to redirect the Excel file to STDOUT. The easiest way to do this is to use the "Minus" file as a file name in the constructor: my $workbook = Spreadsheet::WriteExcel->new("-");
The "Minus" file is documented in perlopentut*. The comment in the above example refers to it as a filehandle but it isn't, it is a file name.
As such you do not need to use tie at all in this situation. You would only need to use the above technique if you wanted to do something unusual such as stream the file to a browser and save a local copy.
The option of passing filehandles to the constructor was introduced mainly to allow the files to be streamed over sockets and to allow Spreadsheet::WriteExcel to work with mod_perl.
* Does anyone know of anywhere else that this is documented?