Remove use of NEXT from the test suite, except for one (commented) case to test back...
Tomas Doran [Fri, 5 Dec 2008 00:55:26 +0000 (00:55 +0000)]
Changes
Makefile.PL
t/lib/Catalyst/Action/TestAfter.pm
t/lib/Catalyst/Action/TestBefore.pm
t/lib/Catalyst/Plugin/Test/Errors.pm
t/lib/Catalyst/Plugin/Test/Headers.pm
t/lib/Catalyst/Plugin/Test/Plugin.pm
t/lib/TestApp.pm
t/lib/TestApp/Action/TestBefore.pm
t/lib/TestApp/Action/TestMyAction.pm
t/unit_core_component_loading.t

diff --git a/Changes b/Changes
index 51c2089..c86f86e 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 # This file documents the revision history for Perl extension Catalyst.
 
 5.8000_04
+        - Remove use of NEXT from the test suite, except for one case
+          which tests if Class::C3::Adopt::NEXT is working (t0m)
         - Use a predicate to avoid recursion in cases where the uri
           method is overridden by a plugin, and calls the base method,
           for example Catalyst::Plugin::SmartURI (t0m)
index 7dee547..3973a5b 100644 (file)
@@ -33,7 +33,6 @@ requires 'URI' => '1.35';
 requires 'Text::Balanced'; # core in 5.8.x but mentioned for completeness
 requires 'MRO::Compat';
 
-test_requires 'NEXT';
 test_requires 'Class::Data::Inheritable';
 
 if (   ( exists $ENV{AGGREGATE_TESTS} && !$ENV{AGGREGATE_TESTS})
index 61fb9d7..199ea25 100644 (file)
@@ -8,7 +8,7 @@ use base qw/Catalyst::Action/;
 sub execute {
     my $self = shift;
     my ( $controller, $c ) = @_;
-    $self->NEXT::execute( @_ );
+    $self->next::method( @_ );
     $c->res->header( 'X-Action-After', $c->stash->{after_message} );
 }
 
index 8bc2e64..456a990 100644 (file)
@@ -9,7 +9,7 @@ sub execute {
     my $self = shift;
     my ( $controller, $c ) = @_;
     $c->stash->{test} = 'works';
-    $self->NEXT::execute( @_ );
+    $self->next::method( @_ );
 }
 
 1;
index b040b1c..8876a4d 100644 (file)
@@ -1,13 +1,13 @@
 package Catalyst::Plugin::Test::Errors;
 
 use strict;
-use NEXT;
+use Class::C3;
 
 sub error {
     my $c = shift;
 
     unless ( $_[0] ) {
-        return $c->NEXT::error(@_);
+        return $c->next::method(@_);
     }
 
     if ( $_[0] =~ /^(Unknown resource|No default action defined)/ ) {
@@ -27,7 +27,7 @@ sub error {
 
     $c->response->headers->push_header( 'X-Catalyst-Error' => $error );
 
-    $c->NEXT::error(@_);
+    $c->next::method(@_);
 }
 
 1;
index 0258a09..3d01b55 100644 (file)
@@ -1,12 +1,12 @@
 package Catalyst::Plugin::Test::Headers;
 
 use strict;
-use NEXT;
+use Class::C3;
 
 sub prepare {
     my $class = shift;
 
-    my $c = $class->NEXT::prepare(@_);
+    my $c = $class->next::method(@_);
 
     $c->response->header( 'X-Catalyst-Engine' => $c->engine );
     $c->response->header( 'X-Catalyst-Debug' => $c->debug ? 1 : 0 );
@@ -27,7 +27,7 @@ sub prepare {
 
 sub prepare_action {
     my $c = shift;
-    $c->NEXT::prepare_action(@_);
+    $c->next::method(@_);
     $c->res->header( 'X-Catalyst-Action' => $c->req->action );
 }
 
index cc6178d..2f6c289 100644 (file)
@@ -1,7 +1,6 @@
 package Catalyst::Plugin::Test::Plugin;
 
 use strict;
-use NEXT;
 
 use base qw/Catalyst::Base Class::Data::Inheritable/;
 
@@ -16,6 +15,9 @@ sub  prepare {
 
     my $class = shift;
 
+# Note: This use of NEXT is deliberately left here to ensure back
+#       compat, as NEXT always used to be loaded, but is now replaced
+#       by Class::C3::Adopt::NEXT.
     my $c = $class->NEXT::prepare(@_);
     $c->response->header( 'X-Catalyst-Plugin-Setup' => $c->ran_setup );
 
index 23df6ef..d65f6cb 100644 (file)
@@ -61,7 +61,7 @@ sub execute {
 sub finalize_error {
     my $c = shift;
     
-    $c->NEXT::finalize_error(@_);
+    $c->next::method(@_);
     
     $c->res->status(500);
     $c->res->body( 'FATAL ERROR: ' . join( ', ', @{ $c->error } ) );
index 0d802bf..c0db6fe 100644 (file)
@@ -9,7 +9,7 @@ sub execute {
     my $self = shift;
     my ( $controller, $c, $test ) = @_;
     $c->res->header( 'X-TestAppActionTestBefore', $test );
-    $self->NEXT::execute( @_ );
+    $self->next::method( @_ );
 }
 
 1;
index 66bcdf9..5a83aee 100644 (file)
@@ -9,7 +9,7 @@ sub execute {
     my $self = shift;
     my ( $controller, $c, $test ) = @_;
     $c->res->header( 'X-TestAppActionTestMyAction', 'MyAction works' );
-    $self->NEXT::execute(@_);
+    $self->next::method(@_);
 }
 
 1;
index 2587385..6b9f8da 100644 (file)
@@ -63,10 +63,10 @@ sub make_component_file {
 
     write_component_file(\@dir_list, $name_final, <<EOF);
 package $fullname;
-use NEXT;
+use Class::C3;
 use base '$compbase';
 sub COMPONENT {
-    my \$self = shift->NEXT::COMPONENT(\@_);
+    my \$self = shift->next::method(\@_);
     no strict 'refs';
     *{\__PACKAGE__ . "::whoami"} = sub { return \__PACKAGE__; };
     \$self;
@@ -166,7 +166,7 @@ package ${appclass}::Model::TopLevel;
 use base 'Catalyst::Model';
 sub COMPONENT {
  
-    my \$self = shift->NEXT::COMPONENT(\@_);
+    my \$self = shift->next::method(\@_);
     no strict 'refs';
     *{\__PACKAGE__ . "::whoami"} = sub { return \__PACKAGE__; };
     \$self;
@@ -185,7 +185,7 @@ package ${appclass}::Model::TopLevel::Nested;
 use base 'Catalyst::Model';
 
 no warnings 'redefine';
-sub COMPONENT { return shift->NEXT::COMPONENT(\@_); }
+sub COMPONENT { return shift->next::method(\@_); }
 1;
 
 EOF