# Amount of data to read from input on each pass
our $CHUNKSIZE = 64 * 1024;
-# XXX - this is only here for compat, do not use!
-has env => ( is => 'rw', writer => '_set_env' );
-my $WARN_ABOUT_ENV = 0;
-around env => sub {
- my ($orig, $self, @args) = @_;
- if(@args) {
- warn "env as a writer is deprecated, you probably need to upgrade Catalyst::Engine::PSGI"
- unless $WARN_ABOUT_ENV++;
- return $self->_set_env(@args);
- }
- return $self->$orig;
-};
-
# XXX - Only here for Engine::PSGI compat
sub prepare_connection {
my ($self, $ctx) = @_;
my ($self, $ctx, %args) = @_;
$ctx->log->psgienv($args{env}) if $ctx->log->can('psgienv');
$ctx->request->_set_env($args{env});
- $self->_set_env($args{env}); # Nasty back compat!
$ctx->response->_set_response_cb($args{response_cb});
}
sub env_on_engine : Action Relative {
my ( $self, $c ) = @_;
- $c->stash(env => $c->engine->env);
+ # JNAP - I changed this to req since the engine no longer
+ # has the env but the tests here are useful.
+ $c->stash(env => $c->req->env);
$c->forward('TestApp::View::Dump::Env');
}
+++ /dev/null
-use strict;
-use warnings;
-use FindBin qw/$Bin/;
-use lib "$Bin/lib";
-
-use Test::More;
-use Test::Fatal;
-use Plack::Test;
-use TestApp;
-use HTTP::Request::Common;
-
-plan skip_all => "Catalyst::Engine::PSGI required for this test"
- unless eval { local $SIG{__WARN__} = sub{}; require Catalyst::Engine::PSGI; 1; };
-
-my $warning;
-local $SIG{__WARN__} = sub { $warning = $_[0] };
-
-TestApp->setup_engine('PSGI');
-my $app = sub { TestApp->run(@_) };
-
-like $warning, qr/You are running Catalyst\:\:Engine\:\:PSGI/,
- 'got deprecation alert warning';
-
-test_psgi $app, sub {
- my $cb = shift;
- is exception {
- my $TIMEOUT_IN_SECONDS = 5;
- local $SIG{ALRM} = sub { die "alarm\n" };
- alarm($TIMEOUT_IN_SECONDS);
-
- my $res = $cb->(GET "/");
- is $res->content, "root index", 'got expected content';
- like $warning, qr/env as a writer/, 'got deprecation alert warning';
-
- alarm(0);
- 1
- }, undef, q{app didn't die or timeout};
-};
-
-done_testing;
-
+++ /dev/null
-use strict;
-use warnings;
-no warnings 'once';
-use FindBin qw/$Bin/;
-use lib "$Bin/lib";
-
-use Test::More;
-
-use File::Spec;
-use File::Temp qw/ tempdir /;
-
-my $temp;
-BEGIN {
- $temp = tempdir( CLEANUP => 1 );
-
- $ENV{CATALYST_HOME} = $temp;
- open(my $psgi, '>', File::Spec->catfile($temp, 'testapp.psgi')) or die;
- print $psgi q{
- use strict;
- use TestApp;
-
- $main::have_loaded_psgi = 1;
- TestApp->setup_engine('PSGI');
- my $app = sub { TestApp->run(@_) };
- };
- close($psgi);
-}
-use Catalyst::Test qw/ TestApp /;
-
-ok !$main::have_loaded_psgi, 'legacy psgi file got ignored';
-
-like do {
- my $warning;
- local $SIG{__WARN__} = sub { $warning = $_[0] };
- ok request('/');
- $warning;
-}, qr/ignored/, 'legacy psgi files raise a warning';
-
-done_testing;
-