The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
use strict;
use warnings;
use Plack::Test;
use Plack::Util;
use Test::More;
use Plack::Middleware::StackTrace;

my $app = Plack::Util::load_psgi 'Extended.psgi';
test_psgi
    app => Plack::Middleware::StackTrace->wrap($app),
    client => sub {
        my $cb = shift;
        my $req = HTTP::Request->new(GET => 'http://localhost/die');
        my $res = do {
            local *STDERR;
            open *STDERR, '>', \my $out or die $!;
            $cb->($req);
        };
        is $res->code, 500;
        like $res->content, qr/OKAY/;
        return;
    };

done_testing;