removed old PSGI Engine backcompat
John Napiorkowski [Tue, 10 Jun 2014 00:06:41 +0000 (20:06 -0400)]
lib/Catalyst/Engine.pm
t/lib/TestApp/Controller/Dump.pm
t/psgi_file_testapp_engine_plackup_compat.t [deleted file]
t/psgi_file_testapp_engine_psgi_compat.t [deleted file]

index 017b2d4..a84bdda 100644 (file)
@@ -22,19 +22,6 @@ use namespace::clean -except => 'meta';
 # 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) = @_;
@@ -653,7 +640,6 @@ sub prepare_request {
     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});
 }
 
index 0864822..bcf13bd 100644 (file)
@@ -16,7 +16,9 @@ sub env : Action Relative {
 
 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');
 }
 
diff --git a/t/psgi_file_testapp_engine_plackup_compat.t b/t/psgi_file_testapp_engine_plackup_compat.t
deleted file mode 100644 (file)
index 4f5a2ea..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-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;
-
diff --git a/t/psgi_file_testapp_engine_psgi_compat.t b/t/psgi_file_testapp_engine_psgi_compat.t
deleted file mode 100644 (file)
index 1f5b4d9..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-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;
-