Plack (software)
Appearance
Perl license (Artistic License v2 + GNU General Public License v1) | |
---|---|
Website | plackperl |
Plack is a
PSGI specification used by other frameworks such as Catalyst and Dancer.[3] Plack allows for testing of Perl web applications without a live web server.[4]
Plackup is a
command line utility to run PSGI applications from the command line.[5]
PSGI
PSGI or Perl Web Server Gateway Interface is an
filehandle-like object
.
Supported backends
As of May 2023[update][7] Plack supports the following server backends:
- CGI
- SCGI
- FastCGI
- mod_perl under Apache 1.3 and 2.0
- Standalone HTTP server included in Plack
- HTTP::Server::Simple
- Corona
- Starman
- Twiggy
- AnyEvent::HTTPD
- AnyEvent::ReverseHTTP
Examples
Using the default standalone HTTP server:
$ plackup app.psgi
HTTP::Server::PSGI: Accepting connections at http://0:5000/
Running as a FastCGI
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 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
- ISBN 9781118235638. Retrieved 29 October 2018.
- ^ "PSGI/Plack - Perl Superglue for Web Frameworks and Web Servers". plackperl.org. Retrieved 9 September 2023.
- ISBN 9780133760811. Retrieved 29 October 2018.
- ISBN 978-1-68050-088-2.
- ^ "plackup - metacpan.org". metacpan.org. Retrieved 30 May 2023.
- ^ chromatic. "Web Application Development with Modern Perl". modernperlbooks.com.
- ^ Plack::Handler modules on CPAN
External links