1FileCache(3pm)         Perl Programmers Reference Guide         FileCache(3pm)
2
3
4

NAME

6       FileCache - keep more files open than the system permits
7

SYNOPSIS

9           use FileCache;
10           # or
11           use FileCache maxopen => 16;
12
13           cacheout $mode, $path;
14           # or
15           cacheout $path;
16           print $path @data;
17
18           $fh = cacheout $mode, $path;
19           # or
20           $fh = cacheout $path;
21           print $fh @data;
22

DESCRIPTION

24       The "cacheout" function will make sure that there's a filehandle open
25       for reading or writing available as the pathname you give it. It auto‐
26       matically closes and re-opens files if you exceed your system's maximum
27       number of file descriptors, or the suggested maximum maxopen.
28
29       cacheout EXPR
30           The 1-argument form of cacheout will open a file for writing ('>')
31           on it's first use, and appending ('>>') thereafter.
32
33           Returns EXPR on success for convenience. You may neglect the return
34           value and manipulate EXPR as the filehandle directly if you prefer.
35
36       cacheout MODE, EXPR
37           The 2-argument form of cacheout will use the supplied mode for the
38           initial and subsequent openings. Most valid modes for 3-argument
39           "open" are supported namely; '>', '+>', '<', '<+', '>>',  '⎪-'  and
40           '-⎪'
41
42           To pass supplemental arguments to a program opened with  '⎪-'  or
43           '-⎪' append them to the command string as you would system EXPR.
44
45           Returns EXPR on success for convenience. You may neglect the return
46           value and manipulate EXPR as the filehandle directly if you prefer.
47

CAVEATS

49       While it is permissible to "close" a FileCache managed file, do not do
50       so if you are calling "FileCache::cacheout" from a package other than
51       which it was imported, or with another module which overrides "close".
52       If you must, use "FileCache::cacheout_close".
53
54       Although FileCache can be used with piped opens ('-⎪' or '⎪-') doing so
55       is strongly discouraged.  If FileCache finds it necessary to close and
56       then reopen a pipe, the command at the far end of the pipe will be
57       reexecuted - the results of performing IO on FileCache'd pipes is
58       unlikely to be what you expect.  The ability to use FileCache on pipes
59       may be removed in a future release.
60
61       FileCache does not store the current file offset if it finds it neces‐
62       sary to close a file.  When the file is reopened, the offset will be as
63       specified by the original "open" file mode.  This could be construed to
64       be a bug.
65

BUGS

67       sys/param.h lies with its "NOFILE" define on some systems, so you may
68       have to set maxopen yourself.
69
70
71
72perl v5.8.8                       2001-09-21                    FileCache(3pm)
Impressum