IO-String

 view release on metacpan or  search on metacpan

t/para.t  view on Meta::CPAN

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

t/read.t  view on Meta::CPAN

    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.342 second using v1.01-cache-2.11-cpan-49f99fa48dc )