Skip to content

Commit

Permalink
[perl #107726] Filter::Simple: ‘use’ and then ‘no’
Browse files Browse the repository at this point in the history
Filter::Simple was erroneously signalling eof if it encountered a
‘no MyFilter’ right after ‘use’:

use MyFilter;
no MyFilter;

In this case it should simply not filter anything.

The reason for the bug was that the ‘while ($status = filter_read())’
loop in Filter::Simple::gen_filter_import was not incrementing $count
(a variable used basically as a boolean to remember whether we are
still getting input from the file) when finding the terminator (no
MyFilter).  So it would conclude after the loop that the file had come
to an end and simply return 0.

[Commit message written by the committer.]
  • Loading branch information
rjbs authored and Father Chrysostomos committed Aug 26, 2016
1 parent 7e9e80a commit 8bc40f3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions dist/Filter-Simple/lib/Filter/Simple.pm
Expand Up @@ -198,6 +198,7 @@ sub gen_filter_import {
if ($terminator{terminator} &&
m/$terminator{terminator}/) {
$lastline = $_;
$count++;
last;
}
$data .= $_;
Expand Down

0 comments on commit 8bc40f3

Please sign in to comment.