Debian Codegraph @

upstream/debian-unstable/man3/FileCache.3perl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "FileCache 3perl"
58 .TH FileCache 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide"
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 FileCache \- keep more files open than the system permits
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 .Vb 1
68 \& no strict \*(Aqrefs\*(Aq;
69 \&
70 \& use FileCache;
71 \& # or
72 \& use FileCache maxopen => 16;
73 \&
74 \& cacheout $mode, $path;
75 \& # or
76 \& cacheout $path;
77 \& print $path @data;
78 \&
79 \& $fh = cacheout $mode, $path;
80 \& # or
81 \& $fh = cacheout $path;
82 \& print $fh @data;
83 .Ve
84 .SH DESCRIPTION
85 .IX Header "DESCRIPTION"
86 The \f(CW\*(C`cacheout\*(C'\fR function will make sure that there's a filehandle open
87 for reading or writing available as the pathname you give it. It
88 automatically closes and re-opens files if you exceed your system's
89 maximum number of file descriptors, or the suggested maximum \fImaxopen\fR.
90 .IP "cacheout EXPR" 4
91 .IX Item "cacheout EXPR"
92 The 1\-argument form of cacheout will open a file for writing (\f(CW\*(Aq>\*(Aq\fR)
93 on it's first use, and appending (\f(CW\*(Aq>>\*(Aq\fR) thereafter.
94 .Sp
95 Returns EXPR on success for convenience. You may neglect the
96 return value and manipulate EXPR as the filehandle directly if you prefer.
97 .IP "cacheout MODE, EXPR" 4
98 .IX Item "cacheout MODE, EXPR"
99 The 2\-argument form of cacheout will use the supplied mode for the initial
100 and subsequent openings. Most valid modes for 3\-argument \f(CW\*(C`open\*(C'\fR are supported
101 namely; \f(CW\*(Aq>\*(Aq\fR, \f(CW\*(Aq+>\*(Aq\fR, \f(CW\*(Aq<\*(Aq\fR, \f(CW\*(Aq<+\*(Aq\fR, \f(CW\*(Aq>>\*(Aq\fR,
102 \&\f(CW \*(Aq|\-\*(Aq \fR and \f(CW \*(Aq\-|\*(Aq \fR
103 .Sp
104 To pass supplemental arguments to a program opened with \f(CW \*(Aq|\-\*(Aq \fR or \f(CW \*(Aq\-|\*(Aq \fR
105 append them to the command string as you would system EXPR.
106 .Sp
107 Returns EXPR on success for convenience. You may neglect the
108 return value and manipulate EXPR as the filehandle directly if you prefer.
109 .SH CAVEATS
110 .IX Header "CAVEATS"
111 While it is permissible to \f(CW\*(C`close\*(C'\fR a FileCache managed file,
112 do not do so if you are calling \f(CW\*(C`FileCache::cacheout\*(C'\fR from a package other
113 than which it was imported, or with another module which overrides \f(CW\*(C`close\*(C'\fR.
114 If you must, use \f(CW\*(C`FileCache::cacheout_close\*(C'\fR.
115 .PP
116 Although FileCache can be used with piped opens ('\-|' or '|\-') doing so is
117 strongly discouraged. If FileCache finds it necessary to close and then reopen
118 a pipe, the command at the far end of the pipe will be reexecuted \- the results
119 of performing IO on FileCache'd pipes is unlikely to be what you expect. The
120 ability to use FileCache on pipes may be removed in a future release.
121 .PP
122 FileCache does not store the current file offset if it finds it necessary to
123 close a file. When the file is reopened, the offset will be as specified by the
124 original \f(CW\*(C`open\*(C'\fR file mode. This could be construed to be a bug.
125 .PP
126 The module functionality relies on symbolic references, so things will break
127 under 'use strict' unless 'no strict "refs"' is also specified.
128 .SH BUGS
129 .IX Header "BUGS"
130 \&\fIsys/param.h\fR lies with its \f(CW\*(C`NOFILE\*(C'\fR define on some systems,
131 so you may have to set \fImaxopen\fR yourself.