summaryrefslogtreecommitdiff
path: root/fml/lib/File
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-03-10 11:11:19 +0000
committerfukachan <fukachan>2001-03-10 11:11:19 +0000
commitd621dcfea1f1213111acf4aa3247a84ff340e313 (patch)
tree3c1256ee2da67663cdc9d79d60816e3af58151dc /fml/lib/File
parenta5c04f7f06246f0158d230427988db3944e946ed (diff)
downloadfml8-d621dcfea1f1213111acf4aa3247a84ff340e313.tar.gz
fml8-d621dcfea1f1213111acf4aa3247a84ff340e313.tar.bz2
fml8-d621dcfea1f1213111acf4aa3247a84ff340e313.zip
update descriptions
Diffstat (limited to 'fml/lib/File')
-rw-r--r--fml/lib/File/RingBuffer.pm16
-rw-r--r--fml/lib/File/Utils.pm34
2 files changed, 40 insertions, 10 deletions
diff --git a/fml/lib/File/RingBuffer.pm b/fml/lib/File/RingBuffer.pm
index fda996b3..f3a4a1dc 100644
--- a/fml/lib/File/RingBuffer.pm
+++ b/fml/lib/File/RingBuffer.pm
@@ -45,8 +45,9 @@ If so, the file names become _smtplog.0, _smtplog.1, ...
=head1 DESCRIPTION
-To log messages but up to some limit, it may be useful to use a file
-in cyclic way. It is chosen among a set of files as a buffer.
+To log messages but up to some limit, it may be useful to use filenames
+in cyclic way.
+The file to write is chosen among a set of files allocated as a buffer.
Consider several files under a directory C<ring/>
where the unit of the ring is 5 here.
@@ -55,16 +56,15 @@ C<ring/> may have 5 files in it.
0 1 2 3 4
To log a message is to write it to one of them.
-At the first time the message is logged to the file C<1>,
-and next time to C<2> and so on.
-If all 5 files are used, pick up and use (overwrite) the oldest one.
-The oldest one is C<0>.
+At the first time the message is logged to the file C<0>,
+and next time to C<1> and so on.
+If all 5 files are used, it reuses and overwrites the oldest one C<0>.
-We use a file in cyclic way as follows:
+So we use a file in cyclic way as follows:
0 -> 1 -> 2 -> 3 -> 4 -> 0 -> 1 -> ...
-We expires the old data.
+We expire the old data.
A file name is a number for simplicity.
The latest number is holded in C<ring/.seq> file (C<.seq> in that
direcotry by default) and truncated to 0 by the modulus C<5>.
diff --git a/fml/lib/File/Utils.pm b/fml/lib/File/Utils.pm
index 401768aa..b319d86c 100644
--- a/fml/lib/File/Utils.pm
+++ b/fml/lib/File/Utils.pm
@@ -20,7 +20,7 @@ require Exporter;
=head1 NAME
-File::Utils - error handling utilities
+File::Utils - utilities to handle files
=head1 SYNOPSIS
@@ -37,7 +37,6 @@ C<search_program>
and
C<copy>.
-
=head1 METHODS
=cut
@@ -55,6 +54,13 @@ sub error { return $ErrorString;}
sub error_reset { undef $ErrorString;}
+=head2 C<mkdiehier($dir, $mode)>
+
+make a directory C<$dir> by the mode C<$mode> recursively.
+
+=cut
+
+
# Descriptions: "mkdir -p" or "mkdirhier"
# Arguments: directory [file_mode]
# Side Effects: set $ErrorString
@@ -75,6 +81,12 @@ sub mkdirhier
}
+=head2 C<touch($file, $mode)>
+
+create a file which is size zero if the file not exists.
+
+=cut
+
# Descriptions: touch: create file if file not exists
# Arguments: file file_mode
# Side Effects: none
@@ -109,6 +121,18 @@ sub touch
}
+=head2 C<search_program($file [, $path_list ])>
+
+search C<$file>.
+C<$path_list> is the hash array.
+It searches it among C<$path_list> if specified.
+
+The default search path list is
+
+ ('/usr/bin', '/bin', '/sbin', ' /usr/local/bin',
+ '/usr/gnu/bin', '/usr/pkg/bin')
+
+=cut
# Descriptions: file $file executable
# Arguments: file [path_list]
@@ -146,6 +170,12 @@ sub search_program
}
+=head2 C<copy($src, $dst)>
+
+copy C<$src> to C<$dst> in the atomic way.
+This routine uses C<IO::File::Atomic> module.
+
+=cut
# wrappers for delegation :-)
sub copy