IO-Stringy

 view release on metacpan or  search on metacpan

t/IO_Scalar.t  view on Meta::CPAN

    {
        my $ios = IO::Scalar->new(\$all);
        is($ios->getline, $lines[0], "recordsep: undef - get first line");
        local $/ = undef;
        is($ios->getline, join('', @lines[1..$#lines]), "recordsep: undef - slurp the rest");
    }

    # Read paragraph by paragraph
    {
        my $ios = IO::Scalar->new(\$all);
        local $/ = "";
        is($ios->getline, join('', @lines[0..2]), "recordsep: empty - first par");
        is($ios->getline, join('', @lines[6..7]), "recordsep: empty - second par");
        is($ios->getline, join('', @lines[8..10]), "recordsep empty - third par");
    }

    # Read record by record
    {
        my $ios = IO::Scalar->new(\$all);
        local $/ = "1,";
        is($ios->getline, "par 1,", "recordsep: custom - first rec");



( run in 0.408 second using v1.01-cache-2.11-cpan-3b35f9de6a3 )