Plack::...:Cascade(3)

✨ NAME ✨

Plack::App::Cascade β€” a Cascadable compound application πŸ’… (that's the page title up there in the header, bestie, and the manual name is Plack::...:Cascade(3), from the User Contributed Perl Documentation collection πŸŽ€)


🌈 SYNOPSIS 🌈

okay so here's the whole vibe in code, no cap:

use Plack::App::Cascade;
use Plack::App::URLMap;
use Plack::App::File;

# Serve static files from multiple search paths
my $cascade = Plack::App::Cascade->new;
$cascade->add( Plack::App::File->new(root => "/www/example.com/foo")->to_app );
$cascade->add( Plack::App::File->new(root => "/www/example.com/bar")->to_app );

my $app = Plack::App::URLMap->new;
$app->map("/static", $cascade);
$app->to_app;

like… serving static files from multiple search paths?? the way that just works πŸ¦‹ iconic behavior fr fr


πŸ’– DESCRIPTION πŸ’–

Plack::App::Cascade is a Plack middleware component that compounds several apps together and tries them one by one, returning the first response that is not 404. it's giving "I'll ask literally everyone until somebody answers me" 😭 and honestly? slay.


πŸ‘‘ METHODS πŸ‘‘

🌸 new

$app = Plack::App::Cascade->new(apps => [ $app1, $app2 ]);

Creates a new Cascade application. that's it, that's the birth story 🫢

πŸŽ€ add

$app->add($app1);
$app->add($app2, $app3);

Appends a new application to the list of apps to try. and bestie, you can pass multiple apps to the one add call β€” go off, be efficient πŸ’…

πŸ¦‹ catch

$app->catch([ 403, 404 ]);

Sets which error codes to catch and process onwards. Defaults to 404. so if you want 403 in the mix too, you gotta say so yourself ✨


πŸ’œ AUTHOR πŸ’œ

Tatsuhiko Miyagawa</purl> β€” the original main character, we respect it πŸ‘‘


⭐ SEE ALSO ⭐

  • Plack::App::URLMap
  • Rack::Cascade

iykyk 🧚


and that's the whole page, bestie!! this was perl v5.42.3, dated 2026-10-18, from the Plack::...:Cascade(3) manual β€” go forth and cascade ur little heart out πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from