Acme-InputRecordSeparatorIsRegexp
view release on metacpan or search on metacpan
t/01-readline.t view on Meta::CPAN
$z = open $fh, '<', 't/test01.txt';
ok($z, 'OPEN ok');
$t = tied *$fh;
ok($t, '\$fh still tied after open');
my $u1 = $t->input_record_separator;
my $u2 = $t->input_record_separator( qr/12|120|345/ );
ok($u2 eq '(?^:12|120|345)' || # $] >= 5.014
$u2 eq '(?-xism:12|120|345)', # $] < 5.014
'input record separator regexp correct');
ok($u1 ne $u2, 'input record separator updated');
undef $t;
@x = <$fh>;
ok(0 == grep( /120$/, @x ), 'no lines end in "120" anymore');
ok(0 < grep( /12$/, @x ), 'some lines end in "12"');
ok(0 < grep( /345$/, @x ), 'some lines end in "345"');
@not = grep( !/120?$/ && !/345$/, @x );
ok(@not == 1, 'one line does not end in 120, 12, 345');
ok($not[0] eq $x[-1], '... and that is the last line');
close $fh;
t/08-chomp.t view on Meta::CPAN
$yy .= "\r\n";
}
}
open my $xx, '>:raw', 't/test08.txt';
print $xx $yy;
close $xx;
my $fh;
ok(!defined($fh), "\$fh undefined before open call");
my $z = open($fh, '<:raw:irs(\r\n|\r|\n)', "t/test08.txt");
ok(defined($fh), "\$fh updated in open call");
ok($z, 'Acme::InputRecordSeparatorIsRegexp::open ok');
ok(tied(*$fh), 'return tied handle');
(tied *$fh)->{maxrecsize} = 100;
my (@tell, @seek);
push @tell, tell($fh);
while (<$fh>) {
push @seek, $_;
push @tell, tell($fh);
t/08b-chomp.t view on Meta::CPAN
$yy .= "\r\n";
}
}
open my $xx, '>:raw', 't/test08b.txt';
print $xx $yy;
close $xx;
my $fh;
ok(!defined($fh), "\$fh undefined before open call");
my $z = open($fh, '<:raw', "t/test08b.txt");
ok(defined($fh), "\$fh updated in open call");
ok($z, 'builtin open ok');
ok(!tied(*$fh), 'builtin open does not tie filehandle');
$z = binmode $fh, ':irs(\r\n|\r|\n)';
ok($z, 'Acme::InputRecordSeparatorIsRegexp::binmode ok');
ok(tied(*$fh), 'handle is tied after binmode');
(tied *$fh)->{maxrecsize} = 100;
my (@tell, @seek);
push @tell, tell($fh);
( run in 0.341 second using v1.01-cache-2.11-cpan-05444aca049 )