Discussion:
[Mason-devel] 5.10 is somewhat unhappy with alter_superclass
Jesse Vincent
2008-06-01 23:08:36 UTC
Permalink
While testing out RT 3.8 on 5.10, we ran into a mysterious segfault.
We eventually tracked it down to this: In 5.10, if you replace an
entry in @INC things sometimes appear to fall apart.
Mason uses this pattern in HTML::Mason::Request::alter_superclass.

Working on a copy of the list and replacing it later makes RT start
passing tests again.


--- /old/HTML/Mason/Request.pm 2008-02-20 13:10:13.000000000 -0500
+++ /new/HTML/Mason/Request.pm 2008-06-01 19:02:03.000000000 -0400
@@ -351,7 +351,8 @@
my $isa_ref;
{
no strict 'refs';
- $isa_ref = \@{"$class\::ISA"};
+ my @entries = @{$class."::ISA"};
+ $isa_ref = \@entries;
}

# handles multiple inheritance properly and preserve
@@ -365,13 +366,16 @@
if ( $old_super ne $new_super )
{
$isa_ref->[$x] = $new_super;
-
- $class->valid_params( %{ $class->valid_params } );
}
-
last;
}
+ }
+
+ {
+ no strict 'refs';
+ @{$class."::ISA"} = @$isa_ref;
}
+ $class->valid_params( %{ $class->valid_params } );
}

sub exec {
sh-3.2#

Loading...