PSGI

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

PSGI or Perl Web Server Gateway Interface is an interface between web servers and web applications and frameworks written in the Perl programming language that allows writing portable applications that can be run as standalone servers or using CGI, FastCGI, mod_perl, et al. It is inspired by the Web Server Gateway Interface for Python, Rack for Ruby and JSGI for JavaScript.

A PSGI application is a Perl subroutine that accepts arguments as a single hash reference and returns a reference to an array of three elements: an HTTP status code, a reference to an array of HTTP headers and a reference to an array of HTTP body lines (usually a generated HTML document) or a filehandle-like object.

Plack is a reference PSGI implementation.

Web frameworks with PSGI support:

Example application

This is an example hello world PSGI application:

my $app = sub {
    return [200, ['Content-Type' => 'text/plain'], ["hello, world\n"]];
}

Save this file as hello.psgi and run it from the command-line: plackup hello.psgi

Web hosting with support for standard PSGI

External links

  • Plack and PSGI, various links to servers and frameworks
  • PSGI - Perl Web Server Gateway Interface Specification
  • article on Plack and nginx from Catalyzed.org
  • Plack Advent calendar
  • Plack coverage, Catalyst Advent calendar


Retrieved from "https://en.wikipedia.org/w/index.php?title=PSGI&oldid=863045154"
This content was retrieved from Wikipedia : http://en.wikipedia.org/wiki/PSGI
This page is based on the copyrighted Wikipedia article "PSGI"; it is used under the Creative Commons Attribution-ShareAlike 3.0 Unported License (CC-BY-SA). You may redistribute it, verbatim or modified, providing that you comply with the terms of the CC-BY-SA