Skip to content

Commit

Permalink
Be a little more careful to ensure we do not get a last line of undef…
Browse files Browse the repository at this point in the history
… (when calling IO.lines).
  • Loading branch information
colomon committed Feb 7, 2010
1 parent a8ab00b commit 9c39328
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/IO.pm
Expand Up @@ -27,7 +27,10 @@ class IO {
multi method lines($limit = *) {
my $l = $limit ~~ Whatever ?? Inf !! $limit;
gather while !$.eof && $l-- > 0 {
take $.get;
my $line = $.get;
if $line.defined {
take $line;
}
}
}

Expand Down

0 comments on commit 9c39328

Please sign in to comment.