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