Hello Dancers,
Is it possible to print web page output directly using Dancer2?
I'm using Text::CSV_XS to output DB data as CSV like so:
while ( my $row = $sth->fetch ) {
$csv->print ( $io, $row );
}
where $io is a file handle, socket, etc.
At the moment, I'm creating a temp file, writing the data, and then using send_file to dispatch the data. Ideally I'd like to just print it straight to the web output, but (e.g.) setting $io to *STDOUT does not work, and there is no serialiser for csv or plain text.
Is there a shortcut that I'm missing?
Thanks!