NAME Plack::Middleware::Timeout SYNOPSIS my $app = sub { ... }; Plack::Middleeare::Timeout->wrap( $app, timeout => sub { ... } || 60, # optional callback to set the custom response response => sub { my ($response_obj,$execution_time) = @_; $response_obj->code(HTTP_REQUEST_TIMEOUT); $response_obj->body( encode_json({ timeout => 1, other_info => {...}, })); return $plack_response; } ); DESCRIPTION Timeout any plack requests at an arbitrary time. PARAMETERS timeout Determines how we're going to get the timeout value, either subref returning a value or any value accepted by subroutine defined in Time::HiRes::alarm, default 120 seconds. response Optional subroutine that receives two parameters, a Plack::Response object that we can further modify to fit our needs, if none is provided the middleware resolves to emitting a warning: 'Terminated request for uri '%s' due to timeout (%ds)' AUTHOR Tomasz Czepiel LICENCE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.