Rewrite the changelog for the major release
[catagits/Catalyst-Runtime.git] / lib / Catalyst / PSGI.pod
CommitLineData
ae908e7e 1=pod
2
b28a5d4a 3=head1 NAME
4
5Catalyst::PSGI - How Catalyst and PSGI work together
6
7=head1 SYNOPSIS
ae908e7e 8
9Catalyst used to contain a whole set of C<< Catalyst::Engine::XXXX >> classes to
10adapt to various different web servers, and environments (e.g. CGI, FastCGI, mod_perl)
11etc.
12
13This has been changed so that all of that work is done by Catalyst just implementing
14the L<PSGI> specification, and using L<Plack>'s adaptors to implement that functionality.
15
16This means that we can share common code, and fixes for specific web servers.
17
18=head1 I already have an application
19
20If you already have a Catalyst application, then this means very little, and you should be
21able to upgrade to the latest release with little or no trouble (See notes in L<Catalyst::Upgrading>
22for specifics about your web server deployment).
23
24=head1 Writing your own PSGI file.
25
26=head2 What is a .psgi file
27
28A C<< .psgi >> file lets you manually controll how your application code reference is built.
29
30Catalyst normally takes care of this for you, but it's possible to do it manually by
31creating a C<myapp.psgi> file in the root of your application.
32
33The simplest C<.psgi> file for an application called C<TestApp> would be:
34
35 use strict;
36 use warnings;
37 use TestApp;
38
39 my $app = sub { TestApp->psgi_app(@_) };
40
41It should be noted that Catalyst may apply a number of middleware components for
42you automatically, and these B<will not> be applied if you manually create
24fd6115 43a psgi file yourself. Details of these middlewares can be found below.
ae908e7e 44
45Additional information about psgi files can be found at:
46L<http://search.cpan.org/dist/Plack/lib/Plack.pm#.psgi_files>
47
48=head2 Why would I want to make a .psgi file?
49
50Writing your own .psgi file allows you to use the alternate L<plackup> command
51to start your application, and allows you to add classes and extensions
52that implement L<Plack::Middleware>, such as L<Plack::Middleware::ErrorDocument>,
53or L<Plack::Middleware::AccessLog>.
54
55=head2 What is in the .psgi Catalyst generates by default?
56
a412b2f4 57Catalyst generates an application which, if the C<< using_frontend_proxy >>
58setting is on, is wrapped in L<Plack::Middleware::ReverseProxy>, and contains some
59engine specific fixes for uniform behaviour, as contained in:
60
61=over
62
0aafa77a 63=item L<Plack::Middleware::LighttpdScriptNameFix>
a412b2f4 64
65=item L<Plack::Middleware::IIS6ScriptNameFix>
66
c3519b10 67=item nginx - local to Catalyst
a412b2f4 68
69=back
70
71If you override the default by providing your own C<< .psgi >> file, then
72none of these things will be done automatically for you by the PSGI
73application returned when you call C<< MyApp->psgi_app >>, and if you need
74any of this functionality, you'll need to implement this in your C<< .psgi >>
75file yourself.
76
d81c3c19 77An apply_default_middlewares method is supplied to wrap your application
78in the default middlewares if you want this behaviour and you are providing
79your own .psgi file.
3f22de0b 80
ae908e7e 81=head1 SEE ALSO
82
83L<Catalyst::Upgrading>, L<Plack>, L<PSGI::FAQ>, L<PSGI>.
84
85=head1 AUTHORS
86
87Catalyst Contributors, see Catalyst.pm
88
89=head1 COPYRIGHT
90
91This library is free software. You can redistribute it and/or modify
92it under the same terms as Perl itself.
93
94=cut