set body io-handle as the PSGI spec requires, and handle the backcompat case
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Delta.pod
CommitLineData
8c57b129 1=head1 NAME
6c18e892 2
8c57b129 3Catalyst::Delta - Overview of changes between versions of Catalyst
4
5=head1 DESCRIPTION
6
46fff667 7This is an overview of the user-visible changes to Catalyst between major
8Catalyst releases.
9
10=head2 VERSION 5.90060+
11
12We changed the way we return body content (from response) to whatever
13Plack handler you are using (Starman, FastCGI, etc.) We no longer
14always use the streaming interface for the cases when the body is a
15simple scalar, object or filehandle like. In those cases we now just
16pass the simple response on to the plack handler. This might lead to
17some minor differences in how streaming is handled. For example, you
18might notice that streaming starts using chunked encoding when running
19on a server that supports that, or that previously missing headers
20(possible content-length) might appear suddenly correct. Also, if you
21are using middleware like L<Plack::Middleware::XSendfile> and are using
22a filehandle that sets a readable path, your server might now correctly
23handle the file (rather than as before where Catalyst would stream it
24very likely very slowly).
25
26In other words, some things might be meaninglessly different and some
27things that were broken codewise but worked because of Catalyst being
28incorrect might suddenly be really broken. The behavior is now more
29correct in that Catalyst plays better with features that Plack offers
30but if you are making heavy use of the streaming interface there could
31be some differences so you should test carefully (this is probably not
32the vast majority of people). In particular if you are developing
33using one server but deploying using a different one, differences in
34what those server do with streaming should be noted.
35
36We also now more carefully distingush the different between a body set
37to '' and a body that is undef. This might lead to situations where
38again you'll get a content-length were you didn't get one before or
39where a supporting server will start chunking output. If this is an
40issue you can apply the middleware L<Plack::Middleware::BufferedStreaming>
41or report specific problems to the dev team.
b31499bc 42
aa20e9f5 43Also, we have started migrating code in Catalyst to equivilent Plack
44Middleware when such exists and is correct to do so.
45
5bb2a5b3 46=head2 VERSION 5.90053
47
48We are now clarifying the behavior of log, plugins and configuration during
49the setup phase. Since Plugins might require a log during setup, setup_log
50must run BEFORE setup_plugins. This has the unfortunate side effect that
51anyone using the popular ConfigLoader plugin will not be able to supply
52configuration to custom logs since the configuration is not yet finalized
53when setup_log is run (when using ConfigLoader, which is a plugin and is
54not loaded until later.)
55
56As a workaround, you can supply custom log configuration directly into
57the configuration:
58
59 package MyApp;
60 use Catalyst;
61
62 __PACKAGE__->config(
63 my_custom_log_info => { %custom_args },
64 );
65
66 __PACKAGE__->setup;
67
68If you wish to configure the custom logger differently based on ENV, you can
69try:
70
71 package MyApp;
72
73 use Catalyst;
74 use Catalyst::Utils;
75
76 __PACKAGE__->config(
77 Catalyst::Utils::merge_hashes(
78 +{ my_custom_log_info => { %base_custom_args } },
79 +{ do __PACKAGE__->path_to( $ENV{WHICH_CONF}."_conf.pl") },
80 ),
81 );
82
83 __PACKAGE__->setup;
84
85Or create a standalone Configuration class that does the right thing.
86
87Basically if you want to configure a logger via Catalyst global configuration
88you can't use ConfigLoader because it will always be loaded too late to be of
89any use. Patches and workaround options welcomed!
90
9b3b1b9c 91=head2 VERSION 5.9XXXX 'cataplack'
c20710a1 92
93The Catalyst::Engine sub-classes have all been removed and deprecated,
94to be replaced with Plack handlers.
95
96Plack is an implementation of the L<PSGI> specification, which is
97a standard interface between web servers and application frameworks.
98
99This should be no different for developers, and you should not have to
100migrate your applications unless you are using a custom engine already.
101
102This change benefits Catalyst significantly by reducing the amount of
103code inside the framework, and means that the framework gets upstream
104bug fixes in L<Plack>, and automatically gains support for any web server
105which a L<PSGI> compliant handler is written for.
106
107It also allows you more flexibility with your application, and allows
108the use of cross web framework 'middleware'.
109
110Developers are recommended to read L<Catalyst::Upgrading> for notes about
111upgrading, especially if you are using an unusual deployment method.
112
113Documentation for how to take advantage of L<PSGI> can be found in
114L<Catalyst::PSGI>, and information about deploying your application
115has been moved to L<Catalyst::Manual::Deployment>.
116
117=head3 Updated modules:
118
119A number of modules have been updated to pass their tests or not
120produce deprecation warnings with the latest version of Catalyst.
121It is recommended that you upgrade any of these that you are using
122after installing this version of Catalyst.
123
124These extensions are:
125
126=over
127
128=item L<Catalyst::Engine::HTTP::Prefork>
129
130This is now deprecated, see L<Catalyst::Upgrading>.
131
132=item L<Test::WWW::Mechanize::Catalyst>
133
134Has been updated to not produce deprecation warnings, upgrade recommended.
135
136=item Catalyst::ActionRole::ACL
137
138Has been updated to fix failing tests (although older versions still
139function perfectly with this version of Catalyst).
140
141=item Catalyst::Plugin::Session::Store::DBIC
142
143Has been updated to fix failing tests (although older versions still
144function perfectly with this version of Catalyst).
145
14eb7697 146=item Catalyst::Plugin::Authentication
147
148Has been updated to fix failing tests (although older versions still
149function perfectly with this version of Catalyst).
150
c20710a1 151=back
1fae8c61 152
153=head1 PREVIOUS VERSIONS
154
9b3b1b9c 155=head2 VERSION 5.8XXXX 'catamoose'
1fae8c61 156
157=head3 Deprecations
b31499bc 158
e88235ff 159Please see L<Catalyst::Upgrading> for a full description of how changes in the
160framework may affect your application.
161
162Below is a brief list of features which have been deprecated in this release:
163
796a8358 164=over
b31499bc 165
796a8358 166=item ::[MVC]:: style naming scheme has been deprecated and will warn
b31499bc 167
e88235ff 168=item NEXT is deprecated for all applications and components, use MRO::Compat
b31499bc 169
e88235ff 170=item Dispatcher methods which are an implementation detail made private, public versions now warn.
b31499bc 171
e88235ff 172=item MyApp->plugin method is deprecated, use L<Catalyst::Model::Adaptor> instead.
796a8358 173
0a3b8de0 174=item __PACKAGE__->mk_accessors() is supported for backward compatibility only, use Moose attributes instead in new code.
175
7df44a71 176=item Use of Catalyst::Base now warns
177
796a8358 178=back
179
1fae8c61 180=head3 New features
0a3b8de0 181
182=head3 Dispatcher
b31499bc 183
7df44a71 184=over
185
186=item Fix forwarding to Catalyst::Action objects.
187
188=item Add the dispatch_type method
189
190=back
b31499bc 191
0a3b8de0 192=head3 Restarter
b31499bc 193
6171ddd5 194The development server restarter has been improved to be compatible with
195immutable Moose classes, and also to optionally use
196L<B::Hooks::OP::Check::StashChange> to handle more complex application layouts
197correctly.
b31499bc 198
7df44a71 199=head3 $c->uri_for_action method.
b31499bc 200
7df44a71 201Give a private path to the Catalyst action you want to create a URI for.
6c18e892 202
0a3b8de0 203=head3 Logging
b31499bc 204
7df44a71 205Log levels have been made additive.
b31499bc 206
0a3b8de0 207=head3 L<Catalyst::Test>
208
209=over
210
211=item Change to use L<Sub::Exporter>.
212
0a3b8de0 213=item Support mocking multiple virtual hosts
214
215=item New methods like action_ok and action_redirect to write more compact tests
216
217=back
218
7df44a71 219=head3 Catalyst::Response
0a3b8de0 220
7df44a71 221=over
222
223=item *
224
225New print method which prints @data to the output stream, separated by $,.
226This lets you pass the response object to functions that want to write to an
227L<IO::Handle>.
228
229=item *
230
231Added code method as an alias for C<< $res->status >>
0a3b8de0 232
d5a6de01 233=back
234
1fae8c61 235=head3 Consequences of the Moose back end
b31499bc 236
796a8358 237=over
238
239=item *
240
7df44a71 241Components are fully compatible with Moose, and all Moose features, such as
242method modifiers, attributes, roles, BUILD and BUILDARGS methods are fully
243supported and may be used in components and applications.
244
245=item *
246
247Many reusable extensions which would previously have been plugins or base
248classes are better implemented as Moose roles.
249
250=item *
251
a0c37f08 252L<MooseX::MethodAttributes::Role::AttrContainer::Inheritable> is used to contain action
7df44a71 253attributes. This means that attributes are represented in the MOP, and
254decouples action creation from attributes.
796a8358 255
256=item *
257
0a3b8de0 258There is a reasonable API in Catalyst::Controller for working with
796a8358 259and registering actions, allowing a controller sub-class to replace
25f61108 260subroutine attributes for action declarations with an alternate
0a3b8de0 261syntax.
796a8358 262
263=item *
264
0a3b8de0 265Refactored capturing of $app from L<Catalyst::Controller> into
266L<Catalyst::Component::ApplicationAttribute> for easier reuse in other
7df44a71 267components.
268
269=item *
270
271Your application class is forced to become immutable at the end of compilation.
272
273=back
274
1fae8c61 275=head3 Bug fixes
7df44a71 276
277=over
278
279=item *
280
25f61108 281Don't ignore SIGCHLD while handling requests with the development server, so that
7df44a71 282system() and other ways of creating child processes work as expected.
283
284=item *
285
286Fixes for FastCGI when used with IIS 6.0
287
288=item *
289
290Fix a bug in uri_for which could cause it to generate paths with multiple
291slashes in them.
796a8358 292
293=item *
294
7df44a71 295Fix a bug in Catalyst::Stats, stopping garbage being inserted into
296the stats if a user calls begin => but no end
796a8358 297
298=back
299