11 my $o = tie @a, 'Tie::File', $file, recsep => 'blah';
12 print $o ? "ok $N\n" : "not ok $N\n";
18 check_contents("rec0");
22 check_contents("rec0", "rec1");
24 check_contents("rec0", "rec1", "rec2");
26 # 9-14 same-length alterations
28 check_contents("new0", "rec1", "rec2");
30 check_contents("new0", "new1", "rec2");
32 check_contents("new0", "new1", "new2");
34 # 15-24 lengthening alterations
36 check_contents("long0", "new1", "new2");
38 check_contents("long0", "long1", "new2");
40 check_contents("long0", "long1", "long2");
42 check_contents("long0", "longer1", "long2");
44 check_contents("longer0", "longer1", "long2");
46 # 25-34 shortening alterations, including truncation
48 check_contents("short0", "longer1", "long2");
50 check_contents("short0", "short1", "long2");
52 check_contents("short0", "short1", "short2");
54 check_contents("short0", "sh1", "short2");
56 check_contents("sh0", "sh1", "short2");
60 check_contents("sh0", "sh1", "short2", "", "rec4");
62 check_contents("sh0", "sh1", "short2", "rec3", "rec4");
65 # try inserting a record into the middle of an empty file
70 my $x = join 'blah', @c, '';
72 my $open = open FH, "< $file";
74 { local $/; $a = <FH> }
75 print (($open && $a eq $x) ? "ok $N\n" : "not ok $N # file @c\n");
81 $good = 0 unless $a[$_] eq "$c[$_]blah";
83 print (($open && $good) ? "ok $N\n" : "not ok $N # fetch @c\n");