The document discusses various web application frameworks and deployment methods in Perl. It covers common frameworks like CGI, mod_perl, Catalyst, and PSGI. It then discusses running PSGI applications with plackup, configuring middleware, and deploying PSGI apps behind web servers or as standalone daemons. Finally, it briefly covers application deployment and management with tools like daemontools.
53. # myapp.psgi
use strict;
use Plack::Middleware::Foo;
use Plack::Middleware::Bar;
use Plack::Middleware::Baz;
my $app = sub { ... };
$app = Plack::Middlewre::Foo->wrap($app);
$app = Plack::Middlewre::Bar->wrap($app);
$app = Plack::Middlewre::Baz->wrap($app);
$app;
54. # myapp.psgi
use strict;
use Plack::Middleware::Foo;
use Plack::Middleware::Bar;
use Plack::Middleware::Baz;
my $app = sub { ... };
$app = Plack::Middlewre::Foo->wrap($app);
$app = Plack::Middlewre::Bar->wrap($app);
$app = Plack::Middlewre::Baz->wrap($app);
$app;
55. # myapp.psgi
use strict;
use Plack::Builder;
builder {
enable "Foo";
enable "Bar";
enable "Bar";
sub { [
200,
[ "Content-Type" => "text/plain" ],
[ "Hello World" ]
};
};
73. Event Server
Q4M
App
client client client client
74.
75. use strict;
use Plack::Request;
sub {
my $env = shift;
my $req = Plack::Request->new( $env );
my $path = $req->path_info;
my $param = $req->parma('param');
my $res = $req->new_response( 200 );
return $res->finalize();
};