1*0Sstevel@tonic-gate#!./perl 2*0Sstevel@tonic-gateuse FileCache maxopen=>2; 3*0Sstevel@tonic-gateuse vars qw(@files); 4*0Sstevel@tonic-gateBEGIN { 5*0Sstevel@tonic-gate @files = qw(foo bar baz quux Foo_Bar); 6*0Sstevel@tonic-gate chdir 't' if -d 't'; 7*0Sstevel@tonic-gate 8*0Sstevel@tonic-gate #For tests within the perl distribution 9*0Sstevel@tonic-gate @INC = '../lib' if -d '../lib'; 10*0Sstevel@tonic-gate END; 11*0Sstevel@tonic-gate} 12*0Sstevel@tonic-gateEND{ 13*0Sstevel@tonic-gate 1 while unlink @files; 14*0Sstevel@tonic-gate} 15*0Sstevel@tonic-gate 16*0Sstevel@tonic-gateprint "1..2\n"; 17*0Sstevel@tonic-gate 18*0Sstevel@tonic-gate{# Test 3: that we open for append on second viewing 19*0Sstevel@tonic-gate my @cat; 20*0Sstevel@tonic-gate for my $path ( @files ){ 21*0Sstevel@tonic-gate cacheout $path; 22*0Sstevel@tonic-gate print $path "$path 3\n"; 23*0Sstevel@tonic-gate } 24*0Sstevel@tonic-gate for my $path ( @files ){ 25*0Sstevel@tonic-gate cacheout $path; 26*0Sstevel@tonic-gate print $path "$path 33\n"; 27*0Sstevel@tonic-gate } 28*0Sstevel@tonic-gate for my $path ( @files ){ 29*0Sstevel@tonic-gate open($path, '<', $path); 30*0Sstevel@tonic-gate push @cat, do{ local $/; <$path>}; 31*0Sstevel@tonic-gate close($path); 32*0Sstevel@tonic-gate } 33*0Sstevel@tonic-gate print 'not ' unless scalar grep(/\b3$/m, @cat) == scalar @files; 34*0Sstevel@tonic-gate print "ok 1\n"; 35*0Sstevel@tonic-gate @cat = (); 36*0Sstevel@tonic-gate for my $path ( @files ){ 37*0Sstevel@tonic-gate cacheout $path; 38*0Sstevel@tonic-gate print $path "$path 333\n"; 39*0Sstevel@tonic-gate } 40*0Sstevel@tonic-gate for my $path ( @files ){ 41*0Sstevel@tonic-gate open($path, '<', $path); 42*0Sstevel@tonic-gate push @cat, do{ local $/; <$path>}; 43*0Sstevel@tonic-gate close($path); 44*0Sstevel@tonic-gate } 45*0Sstevel@tonic-gate print 'not ' unless scalar grep(/\b33$/m, @cat) == scalar @files; 46*0Sstevel@tonic-gate print "ok 2\n"; 47*0Sstevel@tonic-gate} 48