Re: [perl #36622] y/// at end of file

2005-08-01 Thread Rafael Garcia-Suarez
Michael G Schwern wrote:
 
 Bleadperl appears to have this fixed.  A test is attached.  Ironically
 the fresh_perl test function would always append a newline to the code
 being tested.  I've whacked that out, it was a hold over from the original
 code in t/run/kill_perl.t.

Thanks, applied as change #25252.


Re: [perl #36622] y/// at end of file

2005-07-23 Thread Michael G Schwern
On Thu, Jul 21, 2005 at 11:45:30AM -0700, Piotr Fusik wrote:
 Among perl golf players, it is widely known that perl doesn't like
 y/// at the very end of a file. So, we put an extra space or newline
 just to make perl happy. Fortunately trailing whitespace doesn't
 count to the score. :-)

First let me say how bonkers I went to get either vim or emacs to stop
putting a newline on the end of a file.  For those emacs out there
the variable is require-final-newline, set it to nil.  Unfortunately all
sorts of modes seem to think they know better and set it to true so even if
you shut it off in your confir you often have to manually set it off.


 If you forget to add something after y///, the error messages are very
 misleading. For example, this program:
 
 #!/usr/bin/perl -0
 INIT{$A{$a}=1while$a=pop}1while@A{/[a-z]+/ig}=~/\B/y/B-ZA-Gb-za/B-ZA
 b-za/
 
 when syntax-checked by perl -c gives the following error message:
 Unrecognized character \x81 at deroter.pl line 2.
 
 (do you see any \x81 here?)

Bleadperl appears to have this fixed.  A test is attached.  Ironically
the fresh_perl test function would always append a newline to the code
being tested.  I've whacked that out, it was a hold over from the original
code in t/run/kill_perl.t.


-- 
Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern
Ahh email, my old friend.  Do you know that revenge is a dish that is best 
served cold?  And it is very cold on the Internet!
--- t/test.pl   2005/07/22 18:43:05 1.1
+++ t/test.pl   2005/07/22 18:43:09
@@ -579,7 +579,7 @@
   {if (-e _ and -f _)}
 }
 
-print TEST $prog, \n;
+print TEST $prog;
 close TEST or die Cannot close $tmpfile: $!;
 
 my $results = runperl(%$runperl_args);
--- t/op/tr.t   2005/07/22 18:37:29 1.1
+++ t/op/tr.t   2005/07/22 18:42:16
@@ -6,7 +6,7 @@
 require './test.pl';
 }
 
-plan tests = 99;
+plan tests = 100;
 
 my $Is_EBCDIC = (ord('i') == 0x89  ord('J') == 0xd1);
 
@@ -383,3 +383,7 @@
 $x = \foo;
 is( $x =~ tr/A/A/, 2, 'non-modifying tr/// on a scalar ref' );
 is( ref $x, 'SCALAR', doesn't stringify its argument );
+
+# rt.perl.org 36622.  Perl didn't like a y/// at end of file.  No trailing
+# newline allowed.
+fresh_perl_is(q[$_ = foo; y/A-Z/a-z/], '');