2 # This library is no longer being maintained, and is included for backward
3 # compatibility with Perl 4 programs which may require it.
5 # In particular, this should not be used as an example of modern Perl
6 # programming techniques.
8 # Suggested alternative: FileCache
10 # Open in their package.
22 # But only this sub name is visible to them.
28 if (!$isopen{$file}) {
29 if (++$numopen > $maxopen) {
30 local(@lru) = sort {$isopen{$a} <=> $isopen{$b};} keys(%isopen);
31 splice(@lru, $maxopen / 3);
33 for (@lru) { &close($_); delete $isopen{$_}; }
35 &open($file, ($saw{$file}++ ?
'>>' : '>') . $file)
36 || die "Can't create $file: $!\n";
38 $isopen{$file} = ++$seq;
46 if (open(PARAM
,'/usr/include/sys/param.h')) {
49 $maxopen = $1 - 4 if /^\s*#\s*define\s+NOFILE\s+(\d+)/;
53 $maxopen = 16 unless $maxopen;