use Catalyst::Controller;
use Data::OptList;
use Devel::InnerPackage ();
-use File::stat;
use Module::Pluggable::Object ();
use Text::SimpleTable ();
use Path::Class::Dir ();
# 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');
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.