From: Tomas Doran Date: Sun, 21 Dec 2008 15:41:42 +0000 (+0000) Subject: Fix the CDI issue, Plugin::Auth's tests now blow up a different way.. X-Git-Tag: 5.8000_05~85 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=8a440eba91ace539964b76901ad0e9274ece4ec6 Fix the CDI issue, Plugin::Auth's tests now blow up a different way.. --- diff --git a/Changes b/Changes index f92595c..1f8c841 100644 --- 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 --- 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? diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index ace6ba1..26b5b75 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -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'); diff --git a/lib/Catalyst/ClassData.pm b/lib/Catalyst/ClassData.pm index 3882ccd..424cb77 100644 --- a/lib/Catalyst/ClassData.pm +++ b/lib/Catalyst/ClassData.pm @@ -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; diff --git a/t/cdi_backcompat_plugin_accessor_override.t b/t/cdi_backcompat_plugin_accessor_override.t index 8a91781..e60ccd6 100644 --- a/t/cdi_backcompat_plugin_accessor_override.t +++ b/t/cdi_backcompat_plugin_accessor_override.t @@ -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/'; + diff --git a/t/lib/CDICompatTestPlugin.pm b/t/lib/CDICompatTestPlugin.pm index 43b4270..470373c 100644 --- a/t/lib/CDICompatTestPlugin.pm +++ b/t/lib/CDICompatTestPlugin.pm @@ -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;