PSGI/Plack

Superglue interface between perl web application frameworks and web servers, just like Perl is the duct tape of the internet.

PSGI is an interface between Perl web applications and web servers, and Plack is a Perl module and toolkit that contains PSGI middleware, helpers and adapters to web servers.

PSGI and Plack are inspired by Python's WSGI and Ruby's Rack.

Documentation

Get Started

Install cpanminus and then run the following command to install Plack and utility modules.

$ cpanm Plack

What People Say

"I love this... I think it's exactly the right answer to what I was looking for, for a really simple webapp."

-Benjamin Trott, CTO and Co-founder of Six Apart

"Wow, this is nothing short of awesome. A big ++ to the entire PSGI/Plack team!"

-Stevan Little, Infinity Interactive, Moose author

"This is something we've needed for a long time: a clean and simple way to respond to HTTP requests without the cruft of CGI"

-Yuval Kogman, Infinity Interactive, KiokuDB developer

"PSGI (is) an absurdly simple, manifestly beautiful specification for an interface between Perl web apps and web servers."

-Patrick Donelan, WebGUI developer

"Thanks for including us! We're very excited about a future where we don't have to worry about web server support"

-Jonathan Swartz, Mason author

"Today, I finished a sizable project to upgrade almost all of our web stuff to run on Plack. Having done that, everything is better!"

-Ricardo Signes, Perl 5 Pumpking

"I \N{HEAVY BLACK HEART} PSGI."

-Simon Cozens, the author of Advanced Perl Programming

"miyagawa++ # fucking awesome"

-Matt S Trout, Shadowcat Systems, Catalyst and DBIx::Class developer

Repositories

Servers

Plack (web server adapters)
Plack core includes a CGI runner (for running any PSGI application as a CGI script), a FastCGI daemon and mod_perl handlers for Apache1 and 2.
HTTP::Server::PSGI
HTTP::Server::PSGI is a reference PSGI standalone web server implementation and is included in the Plack core distribution.
HTTP::Server::Simple::PSGI
HTTP::Server::Simple::PSGI is based on HTTP::Server::Simple and has zero dependency other than HTTP::Server::Simple, which itself doesn't have any dependencies. This is best for embedding to build a standalone web server or dependency free frameworks.
Starman
Starman is a high-performance, preforking and PSGI compatible HTTP server that has unique features such as HTTP/1.1 support, multiple interfaces support including UNIX domain sockets, graceful restarts and dynamic worker pool configuration via signals.
Twiggy
Twiggy is an AnyEvent based non-blocking (asynchronous) and lightweight PSGI web server. Best to run AnyEvent based web applications to implement long-poll, server push or WebSockets etc., such as the one built on top of the Tatsumaki framework.
Corona
Corona is a Coro based PSGI web server that supports coroutines (cooperative threads) for each socket and clients. Best to use with AnyEvent or Coro friendly non-blocking web applications such as Continuity or Tatsumaki framework
Feersum
Feersum is an HTTP server built on EV/libev. Feersum uses a single-threaded, event-based programming architecture to scale and can handle many concurrent connections efficiently in both CPU and RAM.
Starlet
Kazuho Oku's Starlet is based on the reference HTTP::Server::PSGI web server but adds a support for preforking, graceful restarts, shutdown and hot deploy via Server::Starter.
Gazelle
Gazelle is based on Starlet, but has added a lot of performance optimizations using C/XS-based modules as well as new Linux features such as accept4 or writev.
Arriba
Arriba is a preforking PSGI HTTP server based on Starman with added support for the SPDY protocol.
Misc. HTTP server adapters
There are many Perl web servers and adapters on CPAN and Plack handlers for them, to run PSGI applications on FCGI::EV, AnyEvent::FCGI, Danga::Socket, AnyEvent::HTTPD, SCGI, AnyEvent::SCGI and POE. They are available as separate distributions.
ReverseHTTP
ReverseHTTP server allows you to run a PSGI application on your desktop or inside the firewall but allows external access via reversehttp.net gateway.
uWSGI
uWSGI is a C based developer friendly WSGI server. From the 0.9.5 release it include a plugin technology to add support for other languages, which includes an embedded PSGI handler.
mod_psgi
mod_psgi is an Apache2 module that runs PSGI applications using an embedded Perl interpreter. Developed by Jiro Nishiguchi
evpsgi
evpsgi is an evhttp based http server that runs PSGI applications with the embedded Perl interpreter. Developed by Masayoshi Sekimura
Perlbal
Perlbal::Plugin::PSGI allows you to run PSGI applications on Perlbal. Note that because Perlbal runs in a non-blocking event loop (Danga::Socket), your application is also not supposed to block. If your application blocks (with database acesss or network I/O), do not use this plugin and instead run your PSGI application with the prefork Plack server and reverse proxy to the backend as usual.
nginx embedded perl
Kazuhiro Osawa's nginx patches allows you to run PSGI applications on a Perl interpreter embedded inside nginx. This patch is considered highly experimental and not recommended for the production use. You're recommended to run your (possibly blocking) PSGI application with prefork/fastcgi servers and put nginx in front, and in that case you don't need this patch.

Frameworks

Catalyst
Catalyst is one of the most popular web application frameworks in Perl and has native PSGI support as of version 5.9000. Support for older versions is available through Catalyst::Engine::PSGI.
Jifty
Jifty is a full-stack Perl web application framework that comes with continuations, form-based dispatch, ORM and A Pony. Jifty has replaced much of its internals with Plack modules.
CGI::Application
CGI::Application is a CGI.pm-based lightweight web framework. Any CGI::Application based applications can run as a PSGI application using CGI::PSGI and CGI::Application::PSGI.
HTTP::Engine
HTTP::Engine is a micro web application framework and is a "father of PSGI/Plack" since we owe lots of code and ideas. HTTP::Engine itself now has PSGI Interface support as an adapter since 0.03 on CPAN.
Dancer
Dancer is a Sinatra-like micro web application framework and has supported PSGI since version 0.9904.
Mason
Mason allows you to embed code in HTML templates and can now run on any PSGI supported web server using HTML::Mason::PSGIHandler
Squatting
Squatting is a Camping-inspired Web Microframework and has a support for PSGI through Squatting::On::PSGI.
Continuity
Continuity is a Coro based web application libary that supports Continuations to build statefull applications and support PSGI via Coro server since version 1.1.1 on CPAN.
Maypole
Maypole is a Struts-inspired MVC web application frameworks built on top of Class::DBI ORM. Maypole applications can run as PSGI applications using Maypole::PSGI.
Tatsumaki
Tatsumaki is a web application framework built on top of Plack and AnyEvent: natively supports non-blocking I/O through psgi.streaming and psgi.nonblocking, non-blocking HTTP clients, long-poll Comet services and server push.
Mojolicious
Mojolicious is Merb and Sinatra inspired web framework and has zero dependencies to non-core Perl modules. It has a native PSGI adapter since 0.999920 on CPAN.
Other frameworks
There are lots of other individual frameworks that supports PSGI and Plack. Some of them are not available on CPAN but are developed on github: Web::Simple, Angelos, Ark, Schenker, Noe, Kamui and WebNano.

Applications

WebGUI
Patrick Donelan has built PSGI / Plack into WebGUI 8.

Middleware and Utilities

CGI::PSGI
CGI.pm subclass to handle PSGI env hash to provide a CGI.pm-compatible interface. Very useful to migrate CGI.pm-based web application frameworks to the PSGI interface.
Plack::Request
Plack::Request and Plack::Response is a simple wrapper around PSGI environment hash and response array to access those values using an Object oriented API.
IO::Handle::Util
Utility module to create an IO::Handle-like object instantly with a simple interface.
HTTP::Parser::XS
Super fast XS-based PSGI compatible HTTP header parser, used in many Plack server implementations.
CGI::Emulate::PSGI
Run any CGI scripts (whether it uses CGI.pm or not) as a PSGI application by emulating a CGI environment. It does the opposite of CGI runner PSGI server impementation (Plack::Server::CGI). Also take a look at CGI::Compile which compiles an existing CGI scripts into a callable subroutine reference, best to be used with CGI::Emulate::PSGI.

Slides and Blog Posts

Note that some materials and technical details might be outdated.

Plack Handbook
A little book explaining the basics of PSGI and Plack. Content is freely available and you can buy eBook files for downloads.
Plack Blog
Reblogging blog posts about PSGI and Plack
Plack Advent Calendar
24 days of Tips and tricks for PSGI and Plack
Plack: Superglue for Perl web frameworks and servers
Tatsuhiko Miyagawa at O'Reilly OSCON, July 2010
PlebGUI: WebGUI meets Plack
Patrick Donelan writes a good introduction for PSGI and Plack from the web application developers point of view.
I finally get PSGI and Plack!
Simon Cozens writes a great post about what PSGI is, by comparing it with HTTP::Engine.
Tatsumaki, Plack based non-blocking framework
Tatsuhiko Miyagawa explains psgi.streaming interface to enable asynchronous requests in web frameworks. Screencast in Japanese is also available.
PSGI/Plack
Tokuhiro Matsuno and Tatsuhiko Miyagawa at YAPC::Asia 2009 (Japanese).

Community

Tatsuhiko Miyagawa's blog and delicious bookmarks (PSGI and Plack) have a lot of updated information and links to PSGI/Plack related entries. We're chatting on #plack on irc.perl.org and have a low-traffic mailing list.