logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Plack::App::Cascade - Cascadable compound application

Author

       Tatsuhiko Miyagawa

Description

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

Methods

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

           Creates a new Cascade application.

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

           Appends a new application to the list of apps to try. You can pass the multiple apps to the one "add"
           call.

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

           Sets which error codes to catch and process onwards. Defaults to 404.

Name

       Plack::App::Cascade - Cascadable compound application

See Also

       Plack::App::URLMap Rack::Cascade

perl v5.38.2                                       2024-01-20                           Plack::App::Cascade(3pm)

Synopsis

         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;

See Also