[dancer-users] Problems Directly printing to Apache2::RequestRec buffer with dancer
Yanick Champoux
yanick at babyl.dyndns.org
Thu May 1 02:02:22 BST 2014
On April 30, 2014 11:24:32 AM Brian Brandes wrote:
> get '/buffertest' => sub {
> my $r = request->input_handle;
> $r->print("hello world");
> # ref $r == Apache2::RequestRec
> return;
> };
If all you are doing with the $r object is printing, maybe a little wrapper
could do the trick:
sub capture_output(&) {
open my $handle, '>', \my $output;
$_[0]->($handle);
return $output;
}
get '/' => sub {
return capture_output {
my $r = shift;
$r->print( "hello there!");
}
};
Joy,
`/anick
More information about the dancer-users
mailing list