NAME Plack::App::Redirect - Plack application for redirect. SYNOPSIS use Plack::App::Redirect; my $obj = Plack::App::Redirect->new(%parameters); my $psgi_ar = $obj->call($env); my $app = $obj->to_app; METHODS "new" my $obj = Plack::App::Redirect->new(%parameters); Constructor. Returns instance of object. * "redirect_url" Redirect URL. If this URL isn't present, application returns error. "call" my $psgi_ar = $obj->call($env); Implementation of redirect application. Returns reference to array (PSGI structure). "to_app" my $app = $obj->to_app; Creates Plack application. Returns Plack::Component object. EXAMPLE1 use strict; use warnings; use Plack::App::Redirect; use Plack::Runner; # Run application. my $app = Plack::App::Redirect->new( 'redirect_url' => 'https://skim.cz', )->to_app; Plack::Runner->new->run($app); # Output (HEAD on redirected site): # HTTP::Server::PSGI: Accepting connections at http://0:5000/ # HEAD http://localhost:5000/ # 200 OK # Connection: close # Date: Wed, 16 Jun 2021 15:41:44 GMT # Server: nginx/1.17.6 # Content-Length: 3543 # Content-Type: text/html; charset=utf-8 # Last-Modified: Tue, 15 Jun 2021 22:16:46 GMT # Client-Date: Wed, 16 Jun 2021 15:41:44 GMT # Client-Peer: 89.185.227.162:443 # Client-Response-Num: 1 # Client-SSL-Cert-Issuer: /C=US/O=Let's Encrypt/CN=R3 # Client-SSL-Cert-Subject: /CN=skim.cz # Client-SSL-Cipher: TLS_AES_256_GCM_SHA384 # Client-SSL-Socket-Class: IO::Socket::SSL # Strict-Transport-Security: max-age=31536000 EXAMPLE2 use strict; use warnings; use Plack::App::Redirect; use Plack::Runner; # Run application. my $app = Plack::App::Redirect->new->to_app; Plack::Runner->new->run($app); # Output (HEAD on error from app): # HTTP::Server::PSGI: Accepting connections at http://0:5000/ # HEAD http://localhost:5000/ # 404 Not Found # Date: Wed, 16 Jun 2021 15:40:40 GMT # Server: HTTP::Server::PSGI # Content-Length: 1 # Content-Type: text/html; charset=utf-8 # Client-Date: Wed, 16 Jun 2021 15:40:40 GMT # Client-Peer: 127.0.0.1:5000 # Client-Response-Num: 1 DEPENDENCIES Plack::Response, Plack::Request, Plack::Util::Accessor. REPOSITORY <https://github.com/michal-josef-spacek/Plack-App-Redirect> AUTHOR Michal Josef Å paÄek <mailto:skim@cpan.org> <http://skim.cz> LICENSE AND COPYRIGHT © 2021-2022 Michal Josef Å paÄek BSD 2-Clause License VERSION 0.02