[Rt-commit] r3757 - in rt/branches/QUEBEC-EXPERIMENTAL: . html/Elements

jesse at bestpractical.com jesse at bestpractical.com
Thu Sep 1 18:07:12 EDT 2005


Author: jesse
Date: Thu Sep  1 18:07:11 2005
New Revision: 3757

Modified:
   rt/branches/QUEBEC-EXPERIMENTAL/   (props changed)
   rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/Callback
Log:
 r14210 at hualien:  jesse | 2005-09-01 13:47:17 -0400
  r13732 at hualien:  jesse | 2005-08-23 23:38:28 -0400
  * Applied tom's callbacks fix
  
 


Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/Callback
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/Callback	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/Callback	Thu Sep  1 18:07:11 2005
@@ -53,14 +53,27 @@
 my $callbacks = $cache{$CacheKey} || $m->notes($CacheKey);
 
 if (!$callbacks) {
-    my $path = "/Callbacks/*$Page/$_CallbackName";
-
-    $callbacks = [
-        # Skip backup files, and files without a leading package name
-        grep { !/^\.|~$/ and $_ ne "/Callbacks/$Page/$_CallbackName" }
-        $m->interp->resolver->glob_path($path)
-    ];
+    my $path  = "/Callbacks/*$Page/$_CallbackName";
 
+    # Due to API changes after Mason 1.28, we have to check for which
+    # version we're running when getting the component roots
+    my @roots = map { $_->[1] }
+                    $HTML::Mason::VERSION <= 1.28
+                        ? $m->interp->resolver->comp_root_array
+                        : $m->interp->comp_root_array;
+    
+    my %seen;
+    
+    for my $root (@roots) {
+        push @$callbacks,
+            # Skip backup files, files without a leading package name,
+            # and files we've already seen
+            grep {     !/^\.|~$/
+                   and $_ ne "/Callbacks/$Page/$_CallbackName"
+                   and not $seen{$_}++ }
+                 $m->interp->resolver->glob_path($path, $root);
+    }
+    
     $m->notes($CacheKey => $callbacks);
     $cache{$Page,$_CallbackName} = $callbacks if !$RT::DevelMode;
 }


More information about the Rt-commit mailing list