diff options
| author | fukachan <fukachan> | 2001-02-22 12:15:56 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-02-22 12:15:56 +0000 |
| commit | e9929378b91ad8c53c27ff3feafa1bc4f664db5e (patch) | |
| tree | 5be90d683c35e87df0f6786282601fd0d8dbf908 /fml/lib/File | |
| parent | 922b861b34b3033acb57ea050bf5002954c66420 (diff) | |
| download | fml8-e9929378b91ad8c53c27ff3feafa1bc4f664db5e.tar.gz fml8-e9929378b91ad8c53c27ff3feafa1bc4f664db5e.tar.bz2 fml8-e9929378b91ad8c53c27ff3feafa1bc4f664db5e.zip | |
The buffer directory has files with the name C<0>, C<1>, ...
You can specify C<file_name> parameter.
If so, the file names become _smtplog.0, _smtplog.1, ...
Diffstat (limited to 'fml/lib/File')
| -rw-r--r-- | fml/lib/File/RingBuffer.pm | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/fml/lib/File/RingBuffer.pm b/fml/lib/File/RingBuffer.pm index 5fc63250..6c0f37ae 100644 --- a/fml/lib/File/RingBuffer.pm +++ b/fml/lib/File/RingBuffer.pm @@ -32,6 +32,17 @@ File::RingBuffer - IO operations to ring buffer which consists of files ... unlock ... +The buffer directory has files with the name C<0>, C<1>, ... +You can specify C<file_name> parameter. + + $obj = new File::RingBuffer { + directory => '/some/where', + file_name => '_smtplog', + }; + +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 @@ -60,6 +71,14 @@ direcotry by default) and truncated to 0 by the modulus C<5>. =head1 METHODS +=head2 C<open()> + +no argument. + +=head2 C<close()> + +no argument. + =cut @@ -88,20 +107,21 @@ sub new sub _take_file_name { my ($self, $args) = @_; + my $file_name = $args->{ file_name } || ''; my $sequence_file_name = $args->{ sequence_file_name } || '.seq'; my $modulus = $args->{ modulus } || 128; use File::Spec; my $seq_file = File::Spec->catfile($args->{ directory }, $sequence_file_name); - + use File::Sequence; my $sfh = new File::Sequence { sequence_file => $seq_file, modulus => $modulus, }; my $id = $sfh->increment_id; - my $file = File::Spec->catfile($args->{ directory }, $id); + my $file = File::Spec->catfile($args->{ directory }, $file_name.$id); ${*$self}{ _file } = $file; } |
