File-Rotate-Simple

 view release on metacpan or  search on metacpan

lib/File/Rotate/Simple.pm  view on Meta::CPAN

package File::Rotate::Simple;

use v5.14;

use Moo 1.001000;
extends 'Exporter';

use Graph;
use List::Util 1.43, qw/ first /;
use Module::Runtime qw/ require_module /;
use Path::Tiny 0.015;
use Ref::Util qw/ is_blessed_ref /;
use Time::Seconds qw/ ONE_DAY /;
use Types::Standard -types;

use namespace::autoclean;

our $VERSION = 'v0.3.0';

# ABSTRACT: no-frills file rotation

# RECOMMEND PREREQ: Class::Load::XS
# RECOMMEND PREREQ: Ref::Util::XS
# RECOMMEND PREREQ: Type::Tiny::XS

our @EXPORT_OK = qw/ rotate_files /;


has age => (
    is      => 'ro',
    isa     => Int,
    default => 0,
);


has max => (
    is      => 'ro',
    isa     => Int,
    default => 0,
);


has file => (
    is       => 'ro',
    isa      => InstanceOf['Path::Tiny'],
    coerce   => \&path,
    required => 1,
);


has start_num => (
    is      => 'ro',
    isa     => Int,
    default => 1,
);


has extension_format => (
    is      => 'ro',
    isa     => Str,
    default => '.%#',
);


has replace_extension => (
    is  => 'ro',
    isa => Maybe[Str],
);


has if_missing => (
    is      => 'ro',
    isa     => Bool,
    default => 1,
);


has touch => (
    is      => 'ro',
    isa     => Bool,
    default => 0,
);



( run in 0.565 second using v1.01-cache-2.11-cpan-df04353d9ac )