Explicitly document the wrong Engine::PSGI thing.
Tomas Doran [Sun, 27 Mar 2011 12:55:20 +0000 (13:55 +0100)]
I did it accidentally, and it took rafl half an hour to chase down in d5024dd882,
so someone as dumb as me is likely to do it (just substituting the method name,
rather than removing the additional closure) when upgrading from ::Engine::PSGI.

lib/Catalyst.pm
lib/Catalyst/Upgrading.pod

index 3ad1701..71b1b74 100644 (file)
@@ -16,7 +16,6 @@ use Catalyst::Utils;
 use Catalyst::Controller;
 use Data::OptList;
 use Devel::InnerPackage ();
-use File::stat;
 use Module::Pluggable::Object ();
 use Text::SimpleTable ();
 use Path::Class::Dir ();
@@ -1872,9 +1871,9 @@ sub finalize_headers {
         # get the length from a filehandle
         if ( blessed( $response->body ) && $response->body->can('read') || ref( $response->body ) eq 'GLOB' )
         {
-            my $stat = stat $response->body;
-            if ( $stat && $stat->size > 0 ) {
-                $response->content_length( $stat->size );
+            my $size = -s $response->body;
+            if ( $size ) {
+                $response->content_length( $size );
             }
             else {
                 $c->log->warn('Serving filehandle without a content-length');
index c12ea90..5563808 100644 (file)
@@ -106,11 +106,25 @@ Instead, you now say:
         MyCatalystApp->psgi_app;
     };
 
-And also rename C<< script/myapp.psgi >> to C<< myapp.psgi >>.
+In the simplest case:
 
-XXX - FIXME - t/psgi_file_testapp_engine_psgi_compat.t
+    MyCatalystApp->setup_engine('PSGI');
+    my $app = sub { MyCatalystApp->run(@_) }
+
+becomes
+
+    MyCatalystApp->setup_engine('PSGI');
+    my $app = MyCatalystApp->psgi_app(@_);
+
+B<NOT>:
+
+    my $app = sub { MyCatalystApp->psgi_app(@_) };
+    # If you make ^^ this mistake, your app won't work, and will confuse the hell out of you!
+
+You can now rename C<< script/myapp.psgi >> to C<< myapp.psgi >>, and the built-in
+Catalyst scripts, and your test suite will start using your .psgi file.
 
-If you rename your .psgi file without these modifications, then any tests run via
+B<NOTE:> If you rename your .psgi file without these modifications, then any tests run via
 L<Catalyst::Test> will not be compatible with the new release, and will result in
 the development server starting, rather than the expected test running.