The next temptation

By extending the test suite for the write functionality, in order to get the patches also accepted for 5.8.0, I hit a new problem in a situation where I tried to nest (yes I know that's sick) formats:

#!/usr/bin/perl -w

use strict;

format HEADER =
HEADER
.
sub HEADER ()
{
    local $~ = "HEADER";
    my $HEADER;
    open HEADER, ">", \$HEADER;
    select HEADER;
    write;
    close HEADER;
    select STDOUT;
    $HEADER;
    } # HEADER
format STDOUT_TOP =
TOP
@<<<<<
@{[HEADER]}
.
format STDOUT =
STDOUT
@<<<<
$%
.
write;

which should produce:

TOP
HEADER
STDOUT
1

but instead produces:

page overflow at format2_pl line 19.
STDOUT
0
TOP
HEADER

I did not have enough time to find out what exactly is going on, but I did find out that it needs some serious hacking


Prev Next