Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Streaming data using dancer

by Anonymous Monk
on Mar 14, 2013 at 19:51 UTC ( #1023543=note: print w/replies, xml ) Need Help??


in reply to Streaming data using dancer

You don't have  [ $status, $headers, ] which appears to be the required argument to $respond->(), you need  $respond->( [ 200, ['Content...'] ]);

Replies are listed 'Best First'.
Re^2: Streaming data using dancer
by gsiems (Chaplain) on Mar 14, 2013 at 21:10 UTC
    It would be nice if that were the problem, however substituting:
    my $writer = $respond->(200, [ 'Content-Disposition' => 'attachment; filename="data.csv"' ] + );
    with
    my $writer = $respond->([200, [ 'Content-Disposition' => 'attachment; filename="data.csv"' ] +] );
    or even just
    my $writer = $respond->([200, ['Content-Type' => 'text']] );
    still doesn't work (same error).

    I wouldn't be suprised to have it be something so simple. Unfortunately, I've only found the one example in the documentation and it's a little sparse (IMO).

      It would be nice if that were the problem ...

      Yes it would have :)

      I see by override|streaming&i=1&n=1&C=0 that dancer doesn't test interface, so its not surprising the documented examples don't work -- report bug upstream, http://www.perldancer.org/irc is usually occupied

      Also, you could try searching for examples on github, its not unheard of :)

      Found it! The problem was that, even though I'm over-riding things so that it is sending back the results of the loop rather than an actual file-system file, the file-system file has to exist and dancer needs to be able to access it. Rather than dropping a helpful error message along the lines of "file does not exist" it just gacked.

      We're happy now...

        Apparently you can also use  \'fake file' with the contents being 'fake file' :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2016-10-01 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (6 votes). Check out past polls.