IO-Slice
view release on metacpan or search on metacpan
t/06.readline.t view on Meta::CPAN
@twolines = map { scalar readline $sfh } 1 .. 2;
}
'readline() lives';
is $twolines[0], $full[0], 'first line is OK';
is $twolines[1], $full[1], 'second line is OK';
# rewind
seek $sfh, 0, SEEK_SET;
my @got_paragraphs;
lives_ok {
local $/ = '';
@got_paragraphs = readline $sfh;
}
'readline() for paragraphs lives';
my @expected_paragraphs = map { "$_\n" } split /\n\n+/, join '', @full;
is scalar(@got_paragraphs), scalar(@expected_paragraphs),
'number of paragraphs';
is $got_paragraphs[$_], $expected_paragraphs[$_], "paragraph $_ is OK"
for 0 .. $#got_paragraphs;
# rewind
( run in 0.231 second using v1.01-cache-2.11-cpan-3b35f9de6a3 )