From: Nicholas Clark Date: Sat, 15 Apr 2006 16:43:22 +0000 (+0000) Subject: If you return void from a filter subroutine, the caller's status is X-Git-Tag: accepted/trunk/20130322.191538~17956 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bccf3f3d1e8232741671a14320e468bb69bd7bed;p=platform%2Fupstream%2Fperl.git If you return void from a filter subroutine, the caller's status is used. If not, your last statement is the return value, and if it keeps being +ve you'll never hit EOF. The probably should be a sanity check for this in toke.c, but I'm not sure how. p4raw-id: //depot/perl@27814 --- diff --git a/t/op/incfilter.t b/t/op/incfilter.t index 4dbf7e9..2ca4704 100644 --- a/t/op/incfilter.t +++ b/t/op/incfilter.t @@ -56,11 +56,11 @@ do [sub { open $fh, "<", \'fail("File handles and filters work from \@INC");'; -do [$fh, sub {s/fail/pass/}] or die; +do [$fh, sub {s/fail/pass/; return;}] or die; open $fh, "<", \'fail("File handles and filters with state work from \@INC");'; -do [$fh, sub {s/$_[1]/pass/}, 'fail'] or die; +do [$fh, sub {s/$_[1]/pass/; return;}, 'fail'] or die; print "# 2 tests with pipes from subprocesses.\n"; @@ -70,7 +70,7 @@ do $fh or die; open $fh, 'echo fail|' or die $!; -do [$fh, sub {s/$_[1]/pass/}, 'fail'] or die; +do [$fh, sub {s/$_[1]/pass/; return;}, 'fail'] or die; sub rot13_filter { filter_add(sub { @@ -92,7 +92,7 @@ ORTVA {ebg13_svygre}; pass("This will rot13'ed twice"); EOC -do [$fh, sub {tr/A-Za-z/N-ZA-Mn-za-m/;}] or die; +do [$fh, sub {tr/A-Za-z/N-ZA-Mn-za-m/; return;}] or die; my $count = 32; sub prepend_rot13_filter { @@ -119,4 +119,4 @@ ORTVA {cercraq_ebg13_svygre}; pass("This will rot13'ed twice"); EOC -do [$fh, sub {tr/A-Za-z/N-ZA-Mn-za-m/;}] or die; +do [$fh, sub {tr/A-Za-z/N-ZA-Mn-za-m/; return;}] or die;