The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Plack::Middleware::Timeout

SYNOPSIS

    my $app = sub { ... };

    Plack::Middleeare::Timeout->wrap(
        $app,
        timeout  => 60,
        # optional callback to set the custom response 
            my $plack_response = shift;

            $response->code(HTTP_REQUEST_TIMEOUT);
            $response->body( encode_json({
                timeout => 1,
                other_info => {...},
            }));
            return $plack_response;
        }
    );

DESCRIPTION

Timeout any plack requests at an arbitrary time.

AUTHOR

Tomasz Czepiel <tjmc@cpan.org>

LICENCE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.