More CDI related fail
Tomas Doran [Sat, 3 Jan 2009 12:42:16 +0000 (12:42 +0000)]
TODO
lib/Catalyst/ClassData.pm
t/cdi_backcompat_plugin_accessor_override.t
t/lib/CDICompatTestPlugin.pm

diff --git a/TODO b/TODO
index 36e8940..3b26ba3 100644 (file)
--- 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)
 
index 3dde73a..6b14d7e 100644 (file)
@@ -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;
         }
index e60ccd6..9b3bb0f 100644 (file)
@@ -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';
+}
index 470373c..cc7df1c 100644 (file)
@@ -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;