.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Catalyst::PSGI 3pm" .TH Catalyst::PSGI 3pm "2020-09-13" "perl v5.30.3" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Catalyst::PSGI \- How Catalyst and PSGI work together .SH "SYNOPSIS" .IX Header "SYNOPSIS" The \s-1PSGI\s0 specification defines an interface between web servers and Perl-based web applications and frameworks. It supports the writing of portable applications that can be run using various methods (as a standalone server, or using mod_perl, FastCGI, etc.). Plack is an implementation of the \s-1PSGI\s0 specification for running Perl applications. .PP Catalyst used to contain an entire set of \f(CW\*(C`Catalyst::Engine::XXXX\*(C'\fR classes to handle various web servers and environments (e.g. \s-1CGI,\s0 FastCGI, mod_perl) etc. .PP This has been changed in Catalyst 5.9 so that all of that work is done by Catalyst implementing the \s-1PSGI\s0 specification, using Plack's adaptors to implement that functionality. .PP This means that we can share common code, and share fixes for specific web servers. .SH "I already have an application" .IX Header "I already have an application" If you already have a Catalyst application, then you should be able to upgrade to the latest release with little or no trouble (see the notes in Catalyst::Upgrading for specifics about your web server deployment). .SH "Writing your own PSGI file." .IX Header "Writing your own PSGI file." .SS "What is a .psgi file?" .IX Subsection "What is a .psgi file?" A \f(CW\*(C`.psgi\*(C'\fR file lets you control how your application code reference is built. Catalyst will automatically handle this for you, but it's possible to do it manually by creating a \f(CW\*(C`myapp.psgi\*(C'\fR file in the root of your application. .SS "Why would I want to write my own .psgi file?" .IX Subsection "Why would I want to write my own .psgi file?" Writing your own .psgi file allows you to use the alternate plackup command to start your application, and allows you to add classes and extensions that implement Plack::Middleware, such as Plack::Middleware::ErrorDocument or Plack::Middleware::AccessLog. .PP The simplest \f(CW\*(C`.psgi\*(C'\fR file for an application called \f(CW\*(C`TestApp\*(C'\fR would be: .PP .Vb 3 \& use strict; \& use warnings; \& use TestApp; \& \& my $app = TestApp\->psgi_app(@_); .Ve .PP Note that Catalyst will apply a number of middleware components for you automatically, and these \fBwill not\fR be applied if you manually create a psgi file yourself. Details of these components can be found below. .PP Additional information about psgi files can be found at: .SS "What is in the .psgi file Catalyst generates by default?" .IX Subsection "What is in the .psgi file Catalyst generates by default?" Catalyst generates an application which, if the \f(CW\*(C`using_frontend_proxy\*(C'\fR setting is on, is wrapped in Plack::Middleware::ReverseProxy, and contains some engine-specific fixes for uniform behaviour, as contained in: .IP "Plack::Middleware::LighttpdScriptNameFix" 4 .IX Item "Plack::Middleware::LighttpdScriptNameFix" .PD 0 .IP "Plack::Middleware::IIS6ScriptNameFix" 4 .IX Item "Plack::Middleware::IIS6ScriptNameFix" .PD .PP If you override the default by providing your own \f(CW\*(C`.psgi\*(C'\fR file, then none of these things will be done automatically for you by the \s-1PSGI\s0 application returned when you call \f(CW\*(C`MyApp\->psgi_app\*(C'\fR. Thus, if you need any of this functionality, you'll need to implement this in your \&\f(CW\*(C`.psgi\*(C'\fR file yourself. .PP An apply_default_middlewares method is supplied to wrap your application in the default middlewares if you want this behaviour and you are providing your own .psgi file. .PP This means that the auto-generated (no .psgi file) code looks something like this: .PP .Vb 3 \& use strict; \& use warnings; \& use TestApp; \& \& my $app = TestApp\->apply_default_middlewares(TestApp\->psgi_app(@_)); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Catalyst::Upgrading, Plack, \s-1PSGI::FAQ\s0, \s-1PSGI\s0. .SH "AUTHORS" .IX Header "AUTHORS" Catalyst Contributors, see Catalyst.pm .SH "COPYRIGHT" .IX Header "COPYRIGHT" This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.