Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Write a Filehandle w/Dancer2

by Anonymous Monk
on Aug 13, 2014 at 23:41 UTC ( [id://1097363]=note: print w/replies, xml ) Need Help??


in reply to Write a Filehandle w/Dancer2

Probably similar to Dancer-1.x, see Re^2: Dancer as a proxy, it says
get '/stream_example' => sub { return send_file( \'fake contents to be replaced in override', streaming => 1, callbacks => { override => sub {...

Replies are listed 'Best First'.
Re^2: Write a Filehandle w/Dancer2
by hardburn (Abbot) on Aug 14, 2014 at 00:52 UTC

    Tried the below off of the Dancer2 docs, but it returns 'foo':

    return send_file( \'foo', streaming => 1, content_type => $mime_type, callbacks => { override => sub { my ($respond, $response) = @_; my $writer = $respond->([ 200, {} ]); my $buf = ''; while( read( $in_fh, $buf, VID_READ_LENGTH ) ) { $writer->write( $buf ); } } }, );

    Running in the debugger shows that the callback never gets called.


    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

      ... Running in the debugger shows that the callback never gets called.

      Well :) time to UTSL good buddy

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1097363]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-19 15:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found