The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
use strict;
use warnings;
use Test::More;
use Test::Fatal;
use Path::Dispatcher;

my $dispatcher = Path::Dispatcher->new(
    rules => [
        Path::Dispatcher::Rule::Always->new(
            block => sub { die "hi gang"; "foobar matched" },
        ),
    ],
);

like(exception {
    $dispatcher->run("foobar");
}, qr/hi gang/);

done_testing;