Plack (software)

Plack
Original author(s) Tatsuhiko Miyagawa
Developer(s) Tatsuhiko Miyagawa, Tokuhiro Matsuno, Jesse Luehrs, Tomas Doran, Graham Knop and others.
Development status Active
Written in Perl
License Perl License (Artistic License v2 + GNU General Public License v1)
Website plackperl.org
An example of server-side scripting using Perl, Plack and PSGI.

Plack is a Perl web application programming framework inspired by Rack for Ruby and WSGI for Python,[1] and it is the project behind the PSGI specification used by other frameworks such as Catalyst and Dancer.

Plackup is a command line utility to run PSGI applications from the command line.[2]

Supported backends

As of March 2010[3] Plack supports the following server backends:

Examples

Using the default standalone HTTP server:

$ plackup app.psgi
HTTP::Server::PSGI: Accepting connections at http://0:5000/

Running as a FastCGI daemon listening on a Unix socket, ready to be used by any Web server with FastCGI support:

$ plackup -s FCGI-listen /tmp/fcgi.sock app.psgi
FastCGI: manager (pid 3336): initialized
FastCGI: manager (pid 3336): server (pid 3337) started
FastCGI: server (pid 3337): initialized

A working Hello world application run as a one-liner:

$ plackup -e 'sub { [200, ["Content-Type" => "text/plain"], ["Hello, world!"]] }'
HTTP::Server::PSGI: Accepting connections at http://0:5000/

The command above starts an HTTP server listening on port 5000 of every local interface (IP address) and returns this 200 OK response to every HTTP request:

HTTP/1.0 200 OK
Date: Fri, 19 Mar 2010 23:34:10 GMT
Server: HTTP::Server::PSGI
Content-Type: text/plain
Content-Length: 13
 
Hello, world!

References

  1. http://plackperl.org
  2. "plackup - search.cpan.org". search.cpan.org. Retrieved 2016-02-20.
  3. Plack::Handler modules on CPAN


This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.