Fix the CDI issue, Plugin::Auth's tests now blow up a different way..
Tomas Doran [Sun, 21 Dec 2008 15:41:42 +0000 (15:41 +0000)]
Changes
TODO
lib/Catalyst.pm
lib/Catalyst/ClassData.pm
t/cdi_backcompat_plugin_accessor_override.t
t/lib/CDICompatTestPlugin.pm

diff --git a/Changes b/Changes
index f92595c..1f8c841 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
 # This file documents the revision history for Perl extension Catalyst.
 
+        - Fix Catalyst::Plugin::Authentication's authentication
+          plugin backwards compatibility issues by fixing 
+          Class::Data::Inheritable compatibility (t0m)
+          - Test for this (t0m)
         - Fix bug causing Catalyst::Request::Upload's basename method
           to return undef (t0m)
           - Test for this (Carl Franks)
diff --git a/TODO b/TODO
index 78bee7c..54434f9 100644 (file)
--- a/TODO
+++ b/TODO
@@ -4,11 +4,25 @@ Pending patches:
   - Adopt::NEXT
      - updated docs with how to disable it (t0m/rafl)
 
-Known issues:  
+Back-compat investigation / konwon issues:
+
+  - Find out why C::P::A's test suite causes the 'stack' attributes
+    default method to not be called. (new not being run??)
+
+  - Common engine test failures, look into and get tests into core.
+
+  - CatalystX-Imports, Class::MOP doesn't consider anon subs in the symbol 
+    table as methods, tests + fix, or explanation and documentation?
+    (rafl & phaylon)
+
+  - Run another round of repository smokes against latest 5.80 trunk, manually
+    go through all the things which are broken (t0m).
+
+  - Issues with TWMC not being loaded when it used to be in 5.70 
+    (Bill Moseley)
+
+  - Fix memory leaks (I already tried Devel::Leak::Object, but no joy).
 
-  - Fix t/cdi_backcompat_plugin_accessor_override.t - Catalyst::ClassData
-    doesn't emulate Class::Data::Inheritable by crapping on the symbol table
-    of the top level MyApp class, which causes back-compat fail.
 
 Cleanups:
 
@@ -47,22 +61,6 @@ Profiling:
 
   - vs 5.70 and optimisation as needed.
 
-Back-compat investigation:
-
-  - Common engine test failures, look into and get tests into core.
-
-  - CatalystX-Imports, Class::MOP doesn't consider anon subs in the symbol 
-    table as methods, tests + fix, or explanation and documentation?
-    (rafl & phaylon)
-  
-  - Run another round of repository smokes against latest 5.80 trunk, manually
-    go through all the things which are broken (t0m).
-    
-   - Issues with TWMC not being loaded when it used to be in 5.70 
-     (Bill Moseley)
-     
-   - Fix memory leaks (I already tried Devel::Leak::Object, but no joy).
-
 Tests:
 
   - Moosified test application?
index ace6ba1..26b5b75 100644 (file)
@@ -34,7 +34,8 @@ use Carp qw/croak carp/;
 
 BEGIN { require 5.008001; }
 
-has stack => (is => 'rw', default => sub { [] });
+# FIXME lazy => 1 here makes C::P::Auth tests pass?!?
+has stack => (is => 'ro', default => sub { [] });
 has stash => (is => 'rw', default => sub { {} });
 has state => (is => 'rw', default => 0);
 has stats => (is => 'rw');
index 3882ccd..424cb77 100644 (file)
@@ -29,6 +29,13 @@ sub mk_classdata {
      return ${$v};
     } else {
       foreach my $super ( $meta->linearized_isa ) {
+        # If there is a code symbol for this attr in a parent class, 
+        # then copy it into our package. Is this the correct
+        # fix for C::D::I back-compat? (t0m)
+        my $parent_symbol = *{"${super}::${attribute}"}{CODE} ? \&{"${super}::${attribute}"} : undef;
+        if (defined $parent_symbol) {
+          *{"${pkg}::${attribute}"} = $parent_symbol;
+        }
         # tighter version of same after
         # my $super_meta = Moose::Meta::Class->initialize($super);
         my $v = ${"${super}::"}{$attribute} ? *{"${super}::${attribute}"}{SCALAR} : undef;
index 8a91781..e60ccd6 100644 (file)
@@ -24,9 +24,7 @@ $SIG{__DIE__} = \&Carp::confess;
     __PACKAGE__->config;
 }
 
-TODO: {
-    local $TODO = 'The overridden setup in CDICompatTestApp + the overridden accessor causes destruction';
-    lives_ok {
-        CDICompatTestApp->setup;
-    } 'Setup app with plugins which says use base qw/Class::Accessor::Fast/';
-}
+lives_ok {
+    CDICompatTestApp->setup;
+} 'Setup app with plugins which says use base qw/Class::Accessor::Fast/';
+
index 43b4270..470373c 100644 (file)
@@ -15,13 +15,14 @@ package CDICompatTestPlugin;
 use strict;
 use warnings;
 use base qw/Class::Accessor::Fast/;
+use MRO::Compat;
 __PACKAGE__->mk_accessors(qw/_config/);
 
 sub setup {
     my $app = shift;
 
     $app->config;
-    $app->NEXT::setup(@_);
+    $app->next::method(@_);
 }
 
 1;