[dancer-users] Printing output directly

Amelia Ireland aireland at lbl.gov
Mon May 22 17:55:12 BST 2017


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!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20170522/f4b17535/attachment.html>


More information about the dancer-users mailing list