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