[Rt-commit] r12780 - in rt/branches/3.8-TESTING: lib/RT/Interface/Web

jesse at bestpractical.com jesse at bestpractical.com
Mon Jun 2 08:43:03 EDT 2008


Author: jesse
Date: Mon Jun  2 08:43:03 2008
New Revision: 12780

Modified:
   rt/branches/3.8-TESTING/   (props changed)
   rt/branches/3.8-TESTING/lib/RT/Interface/Web/Request.pm

Log:
 r32080 at 122:  jesse | 2008-06-02 08:42:46 -0400
 * Work around a bug in Perl 5.10 which breaks Mason's ability to change inheritance.
 


Modified: rt/branches/3.8-TESTING/lib/RT/Interface/Web/Request.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/Interface/Web/Request.pm	(original)
+++ rt/branches/3.8-TESTING/lib/RT/Interface/Web/Request.pm	Mon Jun  2 08:43:03 2008
@@ -68,6 +68,36 @@
     return $class->SUPER::new(@_);
 }
 
+# XXX TODO: This alter_superclass replaces teh funcitonality in Mason 1.39 
+# with code which doesn't trigger a bug in Perl 5.10. 
+# (Perl 5.10.0 does NOT take kindly to having its @INC entries changed)
+# http://rt.perl.org/rt3/Public/Bug/Display.html?id=54566
+#
+# This routine can be removed when either: 
+#   * RT depends on a version of mason which contains this fix
+#   * Perl 5.10.0 is not supported for running RT
+sub alter_superclass {
+    my $class = shift;
+    my $new_super = shift;
+    my $isa_ref;
+    { no strict 'refs'; my @entries = @{$class."::ISA"}; $isa_ref = \@entries; }
+
+    # handles multiple inheritance properly and preserve
+    # inheritance order
+    for ( my $x = 0; $x <= $#{$isa_ref} ; $x++ ) {
+        if ( $isa_ref->[$x]->isa('HTML::Mason::Request') ) {
+            my $old_super = $isa_ref->[$x];
+                $isa_ref->[$x] = $new_super
+            if ( $old_super ne $new_super );
+            last;
+        }
+    } 
+
+    { no strict 'refs'; @{$class."::ISA"} = @$isa_ref; }
+    $class->valid_params( %{ $class->valid_params } );
+}
+
+
 =head2 callback
 
 Method replaces deprecated component C<Element/Callback>.


More information about the Rt-commit mailing list