when a POST supplies content encoding, dont assume UTF8
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Upgrading.pod
CommitLineData
8c57b129 1=head1 NAME
2
3Catalyst::Upgrading - Instructions for upgrading to the latest Catalyst
4
b8b29bac 5=head1 Upgrading to Catalyst 5.90080
6
7UTF8 encoding is now default. For temporary backwards compatibility, if this
8change is causing you trouble, you can disable it by setting the application
9configuration option to undef:
10
11 MyApp->config(encoding => undef);
12
13But please consider this a temporary measure since it is the intention that
14UTF8 is enabled going forwards and the expectation is that other ecosystem
15projects will assume this as well. At some point you application will not
16correctly function without this setting.
17
0d94e986 18As of 5.90084 we've added two additional configuration flags for more selective
19control over some encoding changes: 'skip_body_param_unicode_decoding' and
20'skip_complex_post_part_handling'. You may use these to more selectively
21disable new features while you are seeking a long term fix. Please review
22CONFIGURATION in L<Catalyst>.
23
d63cc9c8 24For further information, please see L<Catalyst::UTF8>
25
b8b29bac 26A number of projects in the wider ecosystem required minor updates to be able
27to work correctly. Here's the known list:
28
29L<Catalyst::View::TT>, L<Catalyst::View::Mason>, L<Catalyst::View::HTML::Mason>,
30L<Catalyst::View::Xslate>, L<Test::WWW::Mechanize::Catalyst>
31
32You will need to update to modern versions in most cases, although quite a few
33of these only needed minor test case and documentation changes so you will need
34to review the changelog of each one that is relevant to you to determine your
35true upgrade needs.
36
78acc1f7 37=head1 Upgrading to Catalyst 5.90060
38
39Starting in the v5.90059_001 development release, the regexp dispatch type is
40no longer automatically included as a dependency. If you are still using this
41dispatch type, you need to add L<Catalyst::DispatchType::Regex> into your build
42system.
43
44The standalone distribution of Regexp will be supported for the time being, but
45should we find that supporting it prevents us from moving L<Catalyst> forward
46in necessary ways, we reserve the right to drop that support. It is highly
47recommended that you use this last stage of deprecation to change your code.
48
ba7766f8 49=head1 Upgrading to Catalyst 5.90040
717fc5c9 50
8275d3b9 51=head2 Catalyst::Plugin::Unicode::Encoding is now core
52
53The previously stand alone Unicode support module L<Catalyst::Plugin::Unicode::Encoding>
54has been brought into core as a default plugin. Going forward, all you need is
55to add a configuration setting for the encoding type. For example:
56
57 package Myapp::Web;
58
59 use Catalyst;
60
61 __PACKAGE__->config( encoding => 'UTF-8' );
62
63Please note that this is different from the old stand alone plugin which applied
64C<UTF-8> encoding by default (that is, if you did not set an explicit
5fa5b709 65C<encoding> configuration value, it assumed you wanted UTF-8). In order to
8275d3b9 66preserve backwards compatibility you will need to explicitly turn it on via the
67configuration setting. THIS MIGHT CHANGE IN THE FUTURE, so please consider
68starting to test your application with proper UTF-8 support and remove all those
69crappy hacks you munged into the code because you didn't know the Plugin
70existed :)
71
72For people that are using the Plugin, you will note a startup warning suggesting
73that you can remove it from the plugin list. When you do so, please remember to
74add the configuration setting, since you can no longer rely on the default being
75UTF-8. We'll add it for you if you continue to use the stand alone plugin and
76we detect this, but this backwards compatibility shim will likely be removed in
77a few releases (trying to clean up the codebase after all).
78
79If you have trouble with any of this, please bring it to the attention of the
80Catalyst maintainer group.
81
82=head2 basic async and event loop support
83
717fc5c9 84This version of L<Catalyst> offers some support for using L<AnyEvent> and
e37f92f5 85L<IO::Async> event loops in your application. These changes should work
86fine for most applications however if you are already trying to perform
87some streaming, minor changes in this area of the code might affect your
4e6e0ab2 88functionality. Please see L<Catalyst::Response\write_fh> for more and for a
89basic example.
8275d3b9 90
91We consider this feature experimental. We will try not to break it, but we
92reserve the right to make necessary changes to fix major issues that people
93run into when the use this functionality in the wild.
717fc5c9 94
ba7766f8 95=head1 Upgrading to Catalyst 5.90030
96
97=head2 Regex dispatch type is deprecated.
98
99The Regex dispatchtype (L<Catalyst::DispatchType::Regex>) has been deprecated.
100
101You are encouraged to move your application to Chained dispatch (L<Catalyst::DispatchType::Chained>).
102
103If you cannot do so, please add a dependency to Catalyst::DispatchType::Regex to your application's
104Makefile.PL
105
dacd8b0e 106=head1 Upgrading to Catalyst 5.9
5d5f4a73 107
e6006848 108The major change is that L<Plack>, a toolkit for using the L<PSGI>
862a7989 109specification, now replaces most of the subclasses of L<Catalyst::Engine>. If
e6006848 110you are using one of the standard subclasses of L<Catalyst::Engine> this
111should be a straightforward upgrade for you. It was a design goal for
112this release to preserve as much backwards compatibility as possible.
113However, since L<Plack> is different from L<Catalyst::Engine>, it is
114possible that differences exist for edge cases. Therefore, we recommend
115that care be taken with this upgrade and that testing should be greater
116than would be the case with a minor point update. Please inform the
117Catalyst developers of any problems so that we can fix them and
118incorporate tests.
5d5f4a73 119
773b3b08 120It is highly recommended that you become familiar with the L<Plack> ecosystem
ae908e7e 121and documentation. Being able to take advantage of L<Plack> development and
122middleware is a major bonus to this upgrade. Documentation about how to
123take advantage of L<Plack::Middleware> by writing your own C<< .psgi >> file
124is contained in L<Catalyst::PSGI>.
5d5f4a73 125
e6006848 126If you have created a custom subclass of L<Catalyst:Engine>, you will
127need to convert it to be a subclass of L<Plack::Handler>.
5d5f4a73 128
129If you are using the L<Plack> engine, L<Catalyst::Engine::PSGI>, this new
773b3b08 130release supersedes that code.
5d5f4a73 131
e6006848 132If you are using a subclass of L<Catalyst::Engine> that is aimed at
133nonstandard or internal/testing uses, such as
134L<Catalyst::Engine::Embeddable>, you should still be able to continue
135using that engine.
5d5f4a73 136
137Advice for specific subclasses of L<Catalyst::Engine> follows:
138
93d60cae 139=head2 Upgrading the FastCGI Engine
5d5f4a73 140
e6006848 141No upgrade is needed if your myapp_fastcgi.pl script is already upgraded
142to use L<Catalyst::Script::FastCGI>.
5d5f4a73 143
93d60cae 144=head2 Upgrading the mod_perl / Apache Engines
5d5f4a73 145
e6006848 146The engines that are built upon the various iterations of mod_perl,
14148e06 147L<Catalyst::Engine::Apache::MP13> (for mod_perl 1, and Apache 1.x) and
862a7989 148L<Catalyst::Engine::Apache2::MP20> (for mod_perl 2, and Apache 2.x),
bd85860b 149should be seamless upgrades and will work using L<Plack::Handler::Apache1>
14148e06 150or L<Plack::Handler::Apache2> as required.
5d5f4a73 151
e6006848 152L<Catalyst::Engine::Apache2::MP19>, however, is no longer supported, as
862a7989 153Plack does not support mod_perl version 1.99. This is unlikely to be a
154problem for anyone, as 1.99 was a brief beta-test release for mod_perl
1552, and all users of mod_perl 1.99 are encouraged to upgrade to a
156supported release of Apache 2 and mod_perl 2.
5d5f4a73 157
93d60cae 158=head2 Upgrading the HTTP Engine
5d5f4a73 159
040835f0 160The default development server that comes with the L<Catalyst> distribution
161should continue to work as expected with no changes as long as your C<myapp_server>
162script is upgraded to use L<Catalyst::Script::HTTP>.
5d5f4a73 163
93d60cae 164=head2 Upgrading the CGI Engine
5d5f4a73 165
697a3e9e 166If you were using L<Catalyst::Engine::CGI> there is no upgrade needed if your
e6006848 167myapp_cgi.pl script is already upgraded to use L<Catalyst::Script::CGI>.
5d5f4a73 168
cf8eab35 169=head2 Upgrading Catalyst::Engine::HTTP::Prefork
5d5f4a73 170
040835f0 171If you were using L<Catalyst::Engine::HTTP::Prefork> then L<Starman>
da9eab5a 172is automatically loaded. You should (at least) change your C<Makefile.PL>
173to depend on Starman.
0ea8962d 174
da9eab5a 175You can regenerate your C<myapp_server.pl> script with C<catalyst.pl>
176and implement a C<MyApp::Script::Server> class that looks like this:
177
178 package MyApp::Script::Server;
179 use Moose;
180 use namespace::autoclean;
181
182 extends 'CatalystX::Script::Server::Starman';
183
184 1;
185
e6006848 186This takes advantage of the new script system, and will add a number of
187options to the standard server script as extra options are added by
188Starman.
da9eab5a 189
190More information about these options can be seen at
191L<CatalystX::Script::Server::Starman/SYNOPSIS>.
192
193An alternate route to implement this functionality is to write a simple .psgi
e6006848 194file for your application, and then use the L<plackup> utility to start the
da9eab5a 195server.
5d5f4a73 196
93d60cae 197=head2 Upgrading the PSGI Engine
5d5f4a73 198
e6006848 199If you were using L<Catalyst::Engine::PSGI>, this new release supersedes
200this engine in supporting L<Plack>. By default the Engine is now always
201L<Plack>. As a result, you can remove the dependency on
202L<Catalyst::Engine::PSGI> in your C<Makefile.PL>.
8f912f0b 203
204Applications that were using L<Catalyst::Engine::PSGI>
205previously should entirely continue to work in this release with no changes.
206
e6006848 207However, if you have an C<app.psgi> script, then you no longer need to
208specify the PSGI engine. Instead, the L<Catalyst> application class now
209has a new method C<psgi_app> which returns a L<PSGI> compatible coderef
210which you can wrap in the middleware of your choice.
8f912f0b 211
212Catalyst will use the .psgi for your application if it is located in the C<home>
e6006848 213directory of the application.
697a3e9e 214
93a57b4b 215For example, if you were using L<Catalyst::Engine::PSGI> in the past, you will
8f912f0b 216have written (or generated) a C<script/myapp.psgi> file similar to this one:
697a3e9e 217
218 use Plack::Builder;
219 use MyCatalytApp;
220
221 MyCatalystApp->setup_engine('PSGI');
222
223 builder {
224 enable ... # enable your desired middleware
225 sub { MyCatalystApp->run(@_) };
226 };
227
8f912f0b 228Instead, you now say:
697a3e9e 229
230 use Plack::Builder;
231 use MyCatalystApp;
232
233 builder {
234 enable ... #enable your desired middleware
75d68821 235 MyCatalystApp->psgi_app;
697a3e9e 236 };
5d5f4a73 237
34effbc7 238In the simplest case:
8f912f0b 239
34effbc7 240 MyCatalystApp->setup_engine('PSGI');
241 my $app = sub { MyCatalystApp->run(@_) }
242
243becomes
244
34effbc7 245 my $app = MyCatalystApp->psgi_app(@_);
246
247B<NOT>:
248
249 my $app = sub { MyCatalystApp->psgi_app(@_) };
250 # If you make ^^ this mistake, your app won't work, and will confuse the hell out of you!
251
e6006848 252You can now move C<< script/myapp.psgi >> to C<< myapp.psgi >>, and the built-in
773b3b08 253Catalyst scripts and your test suite will start using your .psgi file.
ad15c817 254
e6006848 255B<NOTE:> If you rename your .psgi file without these modifications, then
256any tests run via L<Catalyst::Test> will not be compatible with the new
257release, and will result in the development server starting, rather than
258the expected test running.
93a57b4b 259
c47cd2ce 260B<NOTE:> If you are directly accessing C<< $c->req->env >> to get the PSGI
261environment then this accessor is moved to C<< $c->engine->env >>,
262you will need to update your code.
263
e6006848 264=head2 Engines which are known to be broken
93a57b4b 265
e6006848 266The following engines B<DO NOT> work as of Catalyst version 5.9. The
267core team will be happy to work with the developers and/or users of
268these engines to help them port to the new Plack/Engine system, but for
269now, applications which are currently using these engines B<WILL NOT>
270run without modification to the engine code.
93a57b4b 271
272=over
273
274=item Catalyst::Engine::Wx
275
ad15c817 276=item Catalyst::Engine::Zeus
277
278=item Catalyst::Engine::JobQueue::POE
279
280=item Catalyst::Engine::XMPP2
281
282=item Catalyst::Engine::SCGI
283
93a57b4b 284=back
285
5d5f4a73 286=head2 Engines with unknown status
287
e6006848 288The following engines are untested or have unknown compatibility.
289Reports are highly encouraged:
5d5f4a73 290
ad15c817 291=over
292
293=item Catalyst::Engine::Mojo
294
e6006848 295=item Catalyst::Engine::Server (marked as Deprecated)
ad15c817 296
e6006848 297=item Catalyst::Engine::HTTP::POE (marked as Deprecated)
ad15c817 298
299=back
5d5f4a73 300
3f22de0b 301=head2 Plack functionality
040835f0 302
3f22de0b 303See L<Catalyst::PSGI>.
0aafa77a 304
dacd8b0e 305=head2 Tests in 5.9
4db14a9a 306
e6006848 307Tests should generally work the same in Catalyst 5.9, but there are
308some differences.
4db14a9a 309
e6006848 310Previously, if using L<Catalyst::Test> and doing local requests (against
311a local server), if the application threw an exception then this
312exception propagated into the test.
4db14a9a 313
e6006848 314This behavior has been removed, and now a 500 response will be returned
315to the test. This change standardizes behavior, so that local test
316requests behave similarly to remote requests.
4db14a9a 317
7e2ec16e 318=head1 Upgrading to Catalyst 5.80
319
5687c7f9 320Most applications and plugins should run unaltered on Catalyst 5.80.
7e2ec16e 321
8f61d649 322However, a lot of refactoring work has taken place, and several changes have
1a98f036 323been made which could cause incompatibilities. If your application or plugin
8f61d649 324is using deprecated code, or relying on side effects, then you could have
ba03ccca 325issues upgrading to this release.
5687c7f9 326
cf8eab35 327Most issues found with existing components have been easy to
8f61d649 328solve. This document provides a complete description of behavior changes
329which may cause compatibility issues, and of new Catalyst warnings which
773b3b08 330might be unclear.
7e2ec16e 331
8f61d649 332If you think you have found an upgrade-related issue which is not covered in
333this document, please email the Catalyst list to discuss the problem.
7e2ec16e 334
85f0a66f 335=head1 Moose features
336
8f61d649 337=head2 Application class roles
85f0a66f 338
8f61d649 339You can only apply method modifiers after the application's C<< ->setup >>
85f0a66f 340method has been called. This means that modifiers will not work with methods
773b3b08 341run during the call to C<< ->setup >>.
85f0a66f 342
a6eb852a 343See L<Catalyst::Manual::ExtendingCatalyst> for more information about using
344L<Moose> in your applications.
345
85f0a66f 346=head2 Controller actions in Moose roles
347
d76c88f3 348You can use L<MooseX::MethodAttributes::Role> if you want to declare actions
349inside Moose roles.
85f0a66f 350
d935773d 351=head2 Using Moose in Components
352
353The correct way to use Moose in a component in a both forward and backwards
354compatible way is:
355
356 package TestApp::Controller::Root;
357 use Moose;
358 BEGIN { extends 'Catalyst::Component' }; # Or ::Controller, or whatever
359
360See L<Components which inherit from Moose::Object before Catalyst::Component>.
361
8f61d649 362=head1 Known backwards compatibility breakages
7e2ec16e 363
8f61d649 364=head2 Applications in a single file
85f0a66f 365
366Applications must be in their own file, and loaded at compile time. This
8f61d649 367issue generally only affects the tests of CPAN distributions. Your
368application will fail if you try to define an application inline in a
369block, and use plugins which supply a C< new > method, then use that
370application latter in tests within the same file.
85f0a66f 371
372This is due to the fact that Catalyst is inlining a new method on your
8f61d649 373application class allowing it to be compatible with Moose. The method
374used to do this changed in 5.80004 to avoid the possibility of reporting
375an 'Unknown Error' if your application failed to compile.
85f0a66f 376
38f90e49 377=head2 Issues with Class::C3
378
8f61d649 379Catalyst 5.80 uses the L<Algorithm::C3> method dispatch order. This is
380built into Perl 5.10, and comes via L<Class::C3> for Perl 5.8. This
381replaces L<NEXT> with L<Class::C3::Adopt::NEXT>, forcing all components
382to resolve methods using C3, rather than the unpredictable dispatch
383order of L<NEXT>.
38f90e49 384
cf8eab35 385This issue manifests itself by your application failing to start due to an
5d06547d 386error message about having a non-linear @ISA.
387
8f61d649 388The Catalyst plugin most often causing this is
389L<Catalyst::Plugin::Session::Store::FastMmap> - if you are using this
390plugin and see issues, then please upgrade your plugins, as it has been
391fixed. Note that Makefile.PL in the distribution will warn about known
392incompatible components.
5d06547d 393
394This issue can, however, be found in your own application - the only solution is
395to go through each base class of the class the error was reported against, until
396you identify the ones in conflict, and resolve them.
397
398To be able to generate a linear @ISA, the list of superclasses for each
399class must be resolvable using the C3 algorithm. Unfortunately, when
400superclasses are being used as mixins (to add functionality used in your class),
ae7da8f5 401and with multiple inheritance, it is easy to get this wrong.
38f90e49 402
403Most common is the case of:
404
405 package Component1; # Note, this is the common case
406 use base qw/Class::Accessor::Fast Class::Data::Inheritable/;
407
8f61d649 408 package Component2; # Accidentally saying it this way causes a failure
38f90e49 409 use base qw/Class::Data::Inheritable Class::Accessor::Fast/;
410
411 package GoesBang;
412 use base qw/Component1 Component2/;
413
5d06547d 414Any situation like this will cause your application to fail to start.
38f90e49 415
8f61d649 416For additional documentation about this issue, and how to resolve it, see
5d06547d 417L<Class::C3::Adopt::NEXT>.
38f90e49 418
6f04e56a 419=head2 Components which inherit from Moose::Object before Catalyst::Component
7e2ec16e 420
6f04e56a 421Moose components which say:
7e2ec16e 422
6f04e56a 423 package TestApp::Controller::Example;
424 use Moose;
845bfcd2 425 extends qw/Moose::Object Catalyst::Component/;
7e2ec16e 426
8f61d649 427to use the constructor provided by Moose, while working (if you do some hacks
1a98f036 428with the C< BUILDARGS > method), will not work with Catalyst 5.80 as
6f04e56a 429C<Catalyst::Component> inherits from C<Moose::Object>, and so C< @ISA > fails
25f61108 430to linearize.
6f04e56a 431
6f04e56a 432The correct way to use Moose in a component in a both forward and backwards
433compatible way is:
434
435 package TestApp::Controller::Root;
436 use Moose;
437 BEGIN { extends 'Catalyst::Component' }; # Or ::Controller, or whatever
438
ba03ccca 439Note that the C< extends > declaration needs to occur in a begin block for
3df46b1b 440L<attributes> to operate correctly.
441
d935773d 442This way you do not inherit directly from C<Moose::Object>
443yourself. Having components which do not inherit their constructor from
444C<Catalyst::Component> is B<unsupported>, and has never been recommended,
445therefore you're on your own if you're using this technique. You'll need
446to detect the version of Catalyst your application is running, and deal
447with it appropriately.
448
eaae9a92 449You also don't get the L<Moose::Object> constructor, and therefore attribute
450initialization will not work as normally expected. If you want to use Moose
3df46b1b 451attributes, then they need to be made lazy to correctly initialize.
452
453Note that this only applies if your component needs to maintain component
454backwards compatibility for Catalyst versions before 5.71001 - in 5.71001
455attributes work as expected, and the BUILD method is called normally
eaae9a92 456(although BUILDARGS is not).
3df46b1b 457
458If you depend on Catalyst 5.8, then B<all> Moose features work as expected.
8566c0de 459
d935773d 460You will also see this issue if you do the following:
461
462 package TestApp::Controller::Example;
463 use Moose;
464 use base 'Catalyst::Controller';
465
466as C< use base > appends to @ISA.
467
e11cac87 468=head3 use Moose in MyApp
469
470Similar to the above, this will also fail:
471
472 package MyApp;
473 use Moose;
474 use Catalyst qw/
475 ConfigLoader
476 /;
477 __PACKAGE__->setup;
478
479If you need to use Moose in your application class (e.g. for method modifiers
8f61d649 480etc.) then the correct technique is:
e11cac87 481
482 package MyApp;
483 use Moose;
5b6f82d2 484 use Catalyst;
485
e11cac87 486 extends 'Catalyst';
5b6f82d2 487
488 __PACKAGE__->config( name => 'MyApp' );
e11cac87 489 __PACKAGE__->setup(qw/
490 ConfigLoader
491 /);
492
04a48104 493=head2 Anonymous closures installed directly into the symbol table
494
495If you have any code which installs anonymous subroutine references directly
496into the symbol table, you may encounter breakages. The simplest solution is
497to use L<Sub::Name> to name the subroutine. Example:
498
e11cac87 499 # Original code, likely to break:
1a98f036 500 my $full_method_name = join('::', $package_name, $method_name);
04a48104 501 *$full_method_name = sub { ... };
502
e11cac87 503 # Fixed Code
04a48104 504 use Sub::Name 'subname';
505 my $full_method_name = join('::',$package_name, $method_name);
506 *$full_method_name = subname $full_method_name, sub { ... };
507
8f61d649 508Additionally, you can take advantage of Catalyst's use of L<Class::MOP> and
509install the closure using the appropriate metaclass. Example:
04a48104 510
511 use Class::MOP;
512 my $metaclass = Moose::Meta::Class->initialize($package_name);
513 $metaclass->add_method($method_name => sub { ... });
514
780654ad 515=head2 Hooking into application setup
516
8f61d649 517To execute code during application start-up, the following snippet in MyApp.pm
780654ad 518used to work:
519
520 sub setup {
521 my ($class, @args) = @_;
522 $class->NEXT::setup(@args);
523 ... # things to do after the actual setup
524 }
525
8f61d649 526With Catalyst 5.80 this won't work anymore, because Catalyst no longer
527uses NEXT.pm for method resolution. The functionality was only ever
528originally operational as L<NEXT> remembers what methods have already
529been called, and will not call them again.
780654ad 530
1a98f036 531Using this now causes infinite recursion between MyApp::setup and
532Catalyst::setup, due to other backwards compatibility issues related to how
e6c5b548 533plugin setup works. Moose method modifiers like C<< before|after|around setup
1a98f036 534=> sub { ... }; >> also will not operate correctly on the setup method.
780654ad 535
536The right way to do it is this:
537
538 after setup_finalize => sub {
539 ... # things to do after the actual setup
540 };
541
ade00972 542The setup_finalize hook was introduced as a way to avoid this issue.
1a98f036 543
e11cac87 544=head2 Components with a new method which returns false
7e2ec16e 545
8dd2f514 546Previously, if you had a component which inherited from Catalyst::COMPONENT,
8f61d649 547but overrode the new method to return false, then your class's configuration
8dd2f514 548would be blessed into a hash on your behalf, and this would be returned from
a87f5aa5 549the COMPONENT method.
7e2ec16e 550
8f61d649 551This behavior makes no sense, and so has been removed. Implementing your own
552C< new > method in components is B<highly> discouraged. Instead, you should
553inherit the new method from Catalyst::Component, and use Moose's BUILD
1a98f036 554functionality and/or Moose attributes to perform any construction work
555necessary for your class.
7e2ec16e 556
557=head2 __PACKAGE__->mk_accessor('meta');
558
e11cac87 559Won't work due to a limitation of L<Moose>. This is currently being fixed
560inside Moose.
7e2ec16e 561
562=head2 Class::Data::Inheritable side effects
563
8dd2f514 564Previously, writing to a class data accessor would copy the accessor method
565down into your package.
566
8f61d649 567This behavior has been removed. While the class data is still stored
8dd2f514 568per-class, it is stored on the metaclass of the class defining the accessor.
7e2ec16e 569
8f61d649 570Therefore anything relying on the side effect of the accessor being copied down
8dd2f514 571will be broken.
7e2ec16e 572
1a98f036 573The following test demonstrates the problem:
8dd2f514 574
575 {
576 package BaseClass;
577 use base qw/Class::Data::Inheritable/;
578 __PACKAGE__->mk_classdata('foo');
579 }
580
581 {
582 package Child;
583 use base qw/BaseClass/;
584 }
585
586 BaseClass->foo('base class');
587 Child->foo('sub class');
eaae9a92 588
e11cac87 589 use Test::More;
8dd2f514 590 isnt(BaseClass->can('foo'), Child->can('foo'));
7e2ec16e 591
f4dda4a8 592=head2 Extending Catalyst::Request or other classes in an ad hoc manner using mk_accessors
7e2ec16e 593
8dd2f514 594Previously, it was possible to add additional accessors to Catalyst::Request
595(or other classes) by calling the mk_accessors class method.
7e2ec16e 596
8f61d649 597This is no longer supported - users should make a subclass of the class whose
598behavior they would like to change, rather than globally polluting the
e11cac87 599Catalyst objects.
8be895a7 600
10011c19 601=head2 Confused multiple inheritance with Catalyst::Component::COMPONENT
8be895a7 602
8f61d649 603Previously, Catalyst's COMPONENT method would delegate to the method on
604the right hand side, which could then delegate back again with
605NEXT. This is poor practice, and in addition, makes no sense with C3
606method dispatch order, and is therefore no longer supported.
bcc773b9 607
ba03ccca 608If a COMPONENT method is detected in the inheritance hierarchy to the right
bcc773b9 609hand side of Catalyst::Component::COMPONENT, then the following warning
610message will be emitted:
7e2ec16e 611
8dd2f514 612 There is a COMPONENT method resolving after Catalyst::Component
5687c7f9 613 in ${next_package}.
8dd2f514 614
8f61d649 615The correct fix is to re-arrange your class's inheritance hierarchy so that the
bcc773b9 616COMPONENT method you would like to inherit is the first (left-hand most)
617COMPONENT method in your @ISA.
7e2ec16e 618
7e9340de 619=head2 Development server relying on environment variables
620
621Previously, the development server would allow propagation of system
622environment variables into the request environment, this has changed with the
623adoption of Plack. You can use L<Plack::Middleware::ForceEnv> to achieve the
624same effect.
625
c571d2c8 626=head1 WARNINGS
627
63b546b1 628=head2 Actions in your application class
629
630Having actions in your application class will now emit a warning at application
e256d0e1 631startup as this is deprecated. It is highly recommended that these actions are moved
63b546b1 632into a MyApp::Controller::Root (as demonstrated by the scaffold application
5fa5b709 633generated by catalyst.pl).
da73c6af 634
e256d0e1 635This warning, also affects tests. You should move actions in your test,
636creating a myTest::Controller::Root, like the following example:
da73c6af 637
638 package MyTest::Controller::Root;
95a52a01 639
da73c6af 640 use strict;
641 use warnings;
95a52a01 642
da73c6af 643 use parent 'Catalyst::Controller';
95a52a01 644
da73c6af 645 __PACKAGE__->config(namespace => '');
95a52a01 646
da73c6af 647 sub action : Local {
648 my ( $self, $c ) = @_;
5fa5b709 649 $c->do_something;
da73c6af 650 }
95a52a01 651
da73c6af 652 1;
63b546b1 653
ac9279b0 654=head2 ::[MVC]:: naming scheme
655
656Having packages called MyApp::[MVC]::XX is deprecated and can no longer be generated
657by catalyst.pl
658
659This is still supported, but it is recommended that you rename your application
660components to Model/View/Controller.
661
662A warning will be issued at application startup if the ::[MVC]:: naming scheme is
663in use.
664
ade00972 665=head2 Catalyst::Base
666
8f61d649 667Any code using L<Catalyst::Base> will now emit a warning; this
668module will be removed in a future release.
ade00972 669
c571d2c8 670=head2 Methods in Catalyst::Dispatcher
671
8f61d649 672The following methods in Catalyst::Dispatcher are implementation
673details, which may change in the 5.8X release series, and therefore their use
bcc773b9 674is highly deprecated.
c571d2c8 675
676=over
677
8dd2f514 678=item tree
c571d2c8 679
8dd2f514 680=item dispatch_types
c571d2c8 681
8dd2f514 682=item registered_dispatch_types
c571d2c8 683
8dd2f514 684=item method_action_class
c571d2c8 685
8dd2f514 686=item action_hash
c571d2c8 687
688=item container_hash
689
690=back
691
692The first time one of these methods is called, a warning will be emitted:
7e2ec16e 693
bcc773b9 694 Class $class is calling the deprecated method Catalyst::Dispatcher::$public_method_name,
dacd8b0e 695 this will be removed in Catalyst 5.9
7e2ec16e 696
c571d2c8 697You should B<NEVER> be calling any of these methods from application code.
698
8f61d649 699Plugin authors and maintainers whose plugins currently call these methods
8f5a2bd9 700should change to using the public API, or, if you do not feel the public API
8f61d649 701adequately supports your use case, please email the development list to
8f5a2bd9 702discuss what API features you need so that you can be appropriately supported.
7e2ec16e 703
95b20422 704=head2 Class files with names that don't correspond to the packages they define
7e2ec16e 705
e11cac87 706In this version of Catalyst, if a component is loaded from disk, but no
ba03ccca 707symbols are defined in that component's name space after it is loaded, this
bcc773b9 708warning will be issued:
7e2ec16e 709
bcc773b9 710 require $class was successful but the package is not defined.
7e2ec16e 711
8f61d649 712This is to protect against confusing bugs caused by mistyping package names,
bcc773b9 713and will become a fatal error in a future version.
714
715Please note that 'inner packages' (via L<Devel::InnerPackage>) are still fully
8f61d649 716supported; this warning is only issued when component file naming does not map
bcc773b9 717to B<any> of the packages defined within that component.
7e2ec16e 718
5687c7f9 719=head2 $c->plugin method
720
25f61108 721Calling the plugin method is deprecated, and calling it at run time is B<highly
8dd2f514 722deprecated>.
7e2ec16e 723
95a52a01 724Instead you are recommended to use L<Catalyst::Model::Adaptor> or similar to
ba03ccca 725compose the functionality you need outside of the main application name space.
7e2ec16e 726
4e68badc 727Calling the plugin method will not be supported past Catalyst 5.81.
bcc773b9 728
7e2ec16e 729=cut
4e68badc 730