1Plack::App::Cascade(3)User Contributed Perl DocumentationPlack::App::Cascade(3)
2
3
4

NAME

6       Plack::App::Cascade - Cascadable compound application
7

SYNOPSIS

9         use Plack::App::Cascade;
10         use Plack::App::URLMap;
11         use Plack::App::File;
12
13         # Serve static files from multiple search paths
14         my $cascade = Plack::App::Cascade->new;
15         $cascade->add( Plack::App::File->new(root => "/www/example.com/foo")->to_app );
16         $cascade->add( Plack::App::File->new(root => "/www/example.com/bar")->to_app );
17
18         my $app = Plack::App::URLMap->new;
19         $app->map("/static", $cascade);
20         $app->to_app;
21

DESCRIPTION

23       Plack::App::Cascade is a Plack middleware component that compounds
24       several apps and tries them to return the first response that is not
25       404.
26

METHODS

28       new
29             $app = Plack::App::Cascade->new(apps => [ $app1, $app2 ]);
30
31           Creates a new Cascade application.
32
33       add
34             $app->add($app1);
35             $app->add($app2, $app3);
36
37           Appends a new application to the list of apps to try. You can pass
38           the multiple apps to the one "add" call.
39
40       catch
41             $app->catch([ 403, 404 ]);
42
43           Sets which error codes to catch and process onwards. Defaults to
44           404.
45

AUTHOR

47       Tatsuhiko Miyagawa
48

SEE ALSO

50       Plack::App::URLMap Rack::Cascade
51
52
53
54perl v5.36.0                      2022-09-12            Plack::App::Cascade(3)
Impressum