Hello,

I 'am new to Dancer2 and I tried to migrate some code from mod_perl to Dancer2. Somewhere, I have this mod_perl code :

sub handler {
    ...

    open my $fh, "<$filename" or die $@;
    binmode $fh;

    $req->content_type('application/vnd.oasis.opendocument.spreadsheet');
    $req->headers_out->{'Content-Disposition'} = "attachment; filename=$file";

    my ($n, $data);
    while ($n = read($fh, $data, 1024)) {
        $req->print($data);
    }

    close($fh);

    return Apache2::Const::OK;
}

The mod_perl code send a OpenOffice document to the client.

How can I do the same thing with Dancer2 ?

Thanks,

Jean-Marc

_______________________________________________
dancer-users mailing list
[email protected]
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users

Reply via email to