From: Tomas Doran Date: Sat, 3 Jan 2009 12:42:16 +0000 (+0000) Subject: More CDI related fail X-Git-Tag: 5.8000_05~53 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=df3ea11bb1ad740663f2a4c909fba71612aa6a48 More CDI related fail --- diff --git a/TODO b/TODO index 36e8940..3b26ba3 100644 --- a/TODO +++ b/TODO @@ -33,6 +33,14 @@ Back-compat investigation / known issues: - CatalystX-CRUD fails tests against 5.80 (karpet) + - Catalyst-Plugin-Authorization-ACL fails as + Catalyst::Dispatcher::_do_forward does not fix arguments if you throw + an exception. Needs a test case (Caelum) + + - Catalyst::Plugin::Authentication::Store::DBIC fails as + overriding the setup_finished class data method in a plugin no longer + works correctly (see t/cdi_backcompat_accessor_override.t). + - Issues with TWMC not being loaded when it used to be in 5.70 (Bill Moseley) diff --git a/lib/Catalyst/ClassData.pm b/lib/Catalyst/ClassData.pm index 3dde73a..6b14d7e 100644 --- a/lib/Catalyst/ClassData.pm +++ b/lib/Catalyst/ClassData.pm @@ -33,6 +33,7 @@ sub mk_classdata { # 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; + # FIXME - this is over-enthusiastic? if (defined $parent_symbol) { *{"${pkg}::${attribute}"} = $parent_symbol; } diff --git a/t/cdi_backcompat_plugin_accessor_override.t b/t/cdi_backcompat_plugin_accessor_override.t index e60ccd6..9b3bb0f 100644 --- a/t/cdi_backcompat_plugin_accessor_override.t +++ b/t/cdi_backcompat_plugin_accessor_override.t @@ -2,7 +2,7 @@ use strict; use warnings; use lib 't/lib'; -use Test::More tests => 1; +use Test::More tests => 2; use Test::Exception; # Force a stack trace. @@ -28,3 +28,11 @@ lives_ok { CDICompatTestApp->setup; } 'Setup app with plugins which says use base qw/Class::Accessor::Fast/'; +# And the plugin's setup_finished method should have been run, as accessors +# are not created in MyApp until the data is written to. +TODO: { + local $TODO = "Copying the class data accessor down into MyApp other than at runtime\n" . + " when assigned (as pre exact CDI behavior) causes methods to not get run'; + no warnings 'once'; + is $CDICompatTestPlugin::Data::HAS_RUN_SETUP_FINISHED, 1, 'Plugin setup_finish run'; +} diff --git a/t/lib/CDICompatTestPlugin.pm b/t/lib/CDICompatTestPlugin.pm index 470373c..cc7df1c 100644 --- a/t/lib/CDICompatTestPlugin.pm +++ b/t/lib/CDICompatTestPlugin.pm @@ -25,4 +25,18 @@ sub setup { $app->next::method(@_); } +# However, if we are too enthusiastic about adding accessors to the +# MyApp package, then this method isn't called (as there is a local +# symbol already). + +# Note - use a different package here, so that Moose's +# package detection code doesn't get confused.. +$CDICompatTestPlugin::Data::HAS_RUN_SETUP_FINISHED = 0; + +sub setup_finished { + my $app = shift; + $CDICompatTestPlugin::Data::AS_RUN_SETUP_FINISHED = 1; + $app->next::method(@_); +} + 1;