Fix for redefined sort subs nastiness
>sub sortfunc { &once }
>sub once {
> eval q{
> print "Eval from ", join(':', caller(0)), "\n";
> sub rest {
> print "REST: $a <=> $b\n";
> $a <=> $b
> }
> };
> *sortfunc = *rest;
> &sortfunc;
>}
>@x = sort sortfunc 10, 5, 2.5, 1.25;
That misbehaves due to the redefinition of the sort sub
while the sort is active. That's a big no-no, because
the sortcop was pointing to the CvSTART of the original,
and it will now point to freed memory (if the sub really
got undefined).
Here's a tested patch that does nothing but die under
that circumstance.
p5p-msgid:
199705090004.UAA15032@aatma.engin.umich.edu