From: Rafael Garcia-Suarez Date: Mon, 21 Jul 2003 19:14:35 +0000 (+0000) Subject: [PATCH] Re: Perl formats do not work with tied values X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ea42cebc16314dacc620b3eddbb9295468aa14b9;p=p5sagit%2Fp5-mst-13.2.git [PATCH] Re: Perl formats do not work with tied values From: Dave Mitchell Date: Tue, 15 Jul 2003 20:46:07 +0100 Message-ID: <20030715194607.GA24592@fdgroup.com> plus the regression test : Subject: Re: [PATCH] Re: Perl formats do not work with tied values From: Nicholas Clark Date: Tue, 15 Jul 2003 22:24:04 +0100 Message-ID: <20030715222404.L20414@plum.flirble.org> p4raw-id: //depot/perl@20177 --- diff --git a/pp_ctl.c b/pp_ctl.c index 55ec3c3..76f2e58 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -676,6 +676,7 @@ PP(pp_formline) s++; } sv_chop(sv,s); + SvSETMAGIC(sv); break; case FF_LINEGLOB: diff --git a/t/op/write.t b/t/op/write.t index e5d60e7..1e2f150 100755 --- a/t/op/write.t +++ b/t/op/write.t @@ -5,7 +5,7 @@ BEGIN { @INC = '../lib'; } -print "1..48\n"; +print "1..49\n"; my $CAT = ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') ? 'type' : ($^O eq 'MacOS') ? 'catenate' @@ -283,17 +283,41 @@ $el } } -# 13..48: scary format testing from Merijn H. Brand +{ + # Bug report and testcase by Alexey Tourbin + use Tie::Scalar; + my $v; + tie $v, 'Tie::StdScalar'; + $v = 13; + format OUT13 = +ok ^<<<<<<<<< ~~ +$v +. + open(OUT13, '>Op_write.tmp') || die "Can't create Op_write.tmp"; + write(OUT13); + close OUT13 or die "Could not close: $!"; + print `$CAT Op_write.tmp`; +} + +####################################### +# Easiest to add new tests above here # +####################################### + +# 14..49: scary format testing from Merijn H. Brand + +my $test = 14; +my $tests = 35; if ($^O eq 'VMS' || $^O eq 'MSWin32' || $^O eq 'dos' || $^O eq 'MacOS' || ($^O eq 'os2' and not eval '$OS2::can_fork')) { - foreach (13..48) { print "ok $_ # skipped: '|-' and '-|' not supported\n"; } + foreach ($test..$tests) { + print "ok $_ # skipped: '|-' and '-|' not supported\n"; + } exit(0); } -use strict; # Amazed that this hackery can be made strict ... -my $test = 13; +use strict; # Amazed that this hackery can be made strict ... # Just a complete test for format, including top-, left- and bottom marging # and format detection through glob entries @@ -411,7 +435,7 @@ if (has_format ("EOF")) { close STDOUT; -# That was test 47. +# That was test 48. __END__