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).