nayakgi / perl-compiler

Automatically exported from code.google.com/p/perl-compiler
Other
0 stars 0 forks source link

local $\ should not be preserved in say #323

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
this problem is related to issue 318

What steps will reproduce the problem?

compile that code
____BEGIN_____

    package Bar::Say;
    use feature 'say';

    my $ors;    
    sub PRINT     {
        $ors = $\;
        return 1;
    }

    sub TIEHANDLE {
        my ($class,@val) = @_;
        return bless \@val, $class;
    }

    my $fh = Symbol::gensym;
    my $obj = tie *$fh, 'Bar::Say';

    local $\ = 'something';
    print ${fh} "a".."c";
    print "# print:$ors:\n";
    print "\nok 1 - print\n" if $ors eq 'something';

    say $fh "a".."c";
    print "\n# say:$ors:\n";
    print "\nok 2 - :$ors:".'say sets $\ to \n in PRINT'."\n" if $ors eq "\n";

__END__

What is the expected output?

expected output ( note that $\ is set to \n in say )

# print:something:
something
ok 1 - print
something
# say:
:
something
ok 2 - :
:say sets $\ to \n in PRINT
something

What do you see instead? ( note that print is ok but not say )

# print:something:

ok 1 - print

# say:something

Please use labels and text to provide additional information.

Original issue reported on code.google.com by nicolas....@gmail.com on 8 May 2014 at 8:00

GoogleCodeExporter commented 9 years ago
this is a duplicate of issue 318

Original comment by nicolas....@gmail.com on 8 May 2014 at 8:15