File-Write-Rotate
view release on metacpan or search on metacpan
lib/File/Write/Rotate.pm view on Meta::CPAN
use 5.010001;
use strict;
use warnings;
# we must not use Log::Any, looping if we are used as log output
#use Log::Any '$log';
use File::Spec;
use IO::Compress::Gzip qw(gzip $GzipError);
use Scalar::Util qw(weaken);
#use Taint::Runtime qw(untaint is_tainted);
use Time::HiRes 'time';
our $Debug;
sub new {
my $class = shift;
my %args0 = @_;
my %args;
lib/File/Write/Rotate.pm view on Meta::CPAN
}
sub _get_lock {
my ($self) = @_;
return undef if $self->{lock_mode} eq 'none';
return $self->{_weak_lock} if defined($self->{_weak_lock});
require File::Flock::Retry;
my $lock = File::Flock::Retry->lock($self->lock_file_path);
$self->{_weak_lock} = $lock;
weaken $self->{_weak_lock};
return $lock;
}
# will return \@files. each entry is [filename without compress suffix,
# rotate_suffix (for sorting), period (for sorting), compress suffix (for
# renaming back)]
sub _get_files {
my ($self) = @_;
opendir my ($dh), $self->{dir} or do {
( run in 0.564 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )