From: Perl 5 Porters Date: Wed, 28 Aug 1996 02:37:41 +0000 (+0000) Subject: Re: truncate with file name does not work (with patch) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9b01e405a9bb7e4ded558565e812624f7c7f28fe;p=p5sagit%2Fp5-mst-13.2.git Re: truncate with file name does not work (with patch) The prototype for truncate was changed so that perl won't die with C when the first arg is a bareword (filehandle). I think it was Tom (as in "tchrist") who brought this up. Here's a patch that undoes the damage, makes it work with C, and adds to the testsuite. --- diff --git a/opcode.pl b/opcode.pl index 2c2bc50..50cf214 100755 --- a/opcode.pl +++ b/opcode.pl @@ -477,7 +477,8 @@ recv recv ck_fun imst F R S S eof eof ck_eof is F? tell tell ck_fun st F? seek seek ck_fun s F S S -truncate truncate ck_trunc is F S +# truncate really behaves as if it had both "S S" and "F S" +truncate truncate ck_trunc is S S fcntl fcntl ck_fun st F S S ioctl ioctl ck_fun st F S S diff --git a/toke.c b/toke.c index ccd4aed..6c4b7cd 100644 --- a/toke.c +++ b/toke.c @@ -2516,6 +2516,7 @@ yylex() if (hints & HINT_STRICT_SUBS && lastchar != '-' && strnNE(s,"->",2) && + last_lop_op != OP_TRUNCATE && /* S/F prototype in opcode.pl */ last_lop_op != OP_ACCEPT && last_lop_op != OP_PIPE_OP && last_lop_op != OP_SOCKPAIR)