On Mon, Jul 14, 2003 at 05:37:42AM -0000, Ruediger Schopper wrote: > I belive, that we've found a bug in perl. We discovered it when changing from > perl-5.4.4 to perl-5.8.0, where we got strange results with > write in a program we heavily used without problems. The bug can be reduced to the simpler case: sub f ($); # Comment out to get right result! sub f ($) { my $test = $_[0]; write; format STDOUT = @<<<<<<< $test . } f(1); f(2); It's due to there being multiple CVs associated with f due to to the forward declaration, and to newATTRSUB() copying the contents of the second CV to the first. This causes any nested subs to have CvOUTSIDE pointing to the wrong CV. A call to pad_fixup_inner_anons() fixes up any nested anon subs, but nested formats aren't fixed up. Since I'm currently working on trying to get sub declarations to take effect at the start of a sub rather than at the end (eg sub f($) { f(1) }), I'll see if I can work in a fix for this at the same time. -- "You're so sadly neglected, and often ignored. A poor second to Belgium, When going abroad." Monty Python - "Finland"Thread Previous | Thread Next