NAME
PAGI::App::Cascade - Try apps in sequence until success
SYNOPSIS
use PAGI::App::Cascade;
my $app = PAGI::App::Cascade->new(
apps => [$static_app, PAGI::App::NotFound->new(body => 'nope')],
catch => [404, 405],
)->to_app;
DESCRIPTION
Cascade tries apps in order until one returns a status code not in the catch list. By default, 404 and 405 are caught, causing the next app to be tried.
OPTIONS
apps- Arrayref of apps to try in order. Entries inapps(and arguments toadd) accept anything "to_app" in PAGI::Utils accepts: a coderef, a component object with ato_appmethod, or a class name.catch- Arrayref of status codes to catch (default: [404, 405])
METHODS
add($app)
Add an app to the cascade.