IO-String
view release on metacpan or search on metacpan
c
a
b
c
d
EOT
$/ = "";
ok(<$fh>, "a\n\n");
ok(<$fh>, "a\nb\n\n");
ok(<$fh>, "a\nb\nc\n\n");
ok(<$fh>, "a\nb\nc\nd\n");
ok(<$fh>, undef);
$fh = IO::String->new(<<EOT);
a
b
print "not " unless @lines == 1 && $lines[0] eq $str;
print "ok 3\n";
$io->setpos(index($str, "and"));
$line = <$io>;
print "not " unless $line eq "and a single line.\n\n";
print "ok 4\n";
}
{
local $/ = ""; # paragraph mode
$io->setpos(0);
@lines = <$io>;
print "not " unless @lines == 2 && $lines[1] eq "and a single line.\n\n";
print "ok 5\n";
}
{
local $/ = "is";
$io->setpos(0);
@lines = ();
( run in 0.356 second using v1.01-cache-2.11-cpan-3b35f9de6a3 )