Egg::Plugin::File::Rotate - Plugin that does file rotation.


Egg-Release documentation  | view source Contained in the Egg-Release distribution.

Index


NAME

Top

Egg::Plugin::File::Rotate - Plugin that does file rotation.

SYNOPSIS

Top

  use Egg qw/ File::Rotate /;

  


  my $file_path= '/path/to/savefile'; 

  if ( -e $file_path ) {
     $e->rotate($file_path, stock => 5 );
  }
  my $fh= FileHandle->new("> $file_path") || return do {
    $e->rotate($file_path, reverse => 1 );
    die $!;
    };

  % ls -la /path/to
  drwxr-x---  ***  .
  drwxr-x---  ***  ..
  drw-r--r--  ***  savefile
  drw-r--r--  ***  savefile.1

DESCRIPTION

Top

It numbers and the backup is left for the file that already exists.

METHODS

Top

rotate ([FILE_PATH], [OPTION])

It file rotates.

Passing to the object file is specified for FILE_PATH. If the file doesn't exist, undefined is returned without doing anything.

OPTION is HASH.

If reverse of OPTION is undefined, it file usually rotates. At this time, the rotation file of the number specified for stock is left. The file that leaks from the number of stock is annulled. The defaults of the number of stock are 5, and the lowest value is 3.

  $e->rotate( '/path/to/save.txt', stock=> 10 );

FILE_PATH is renamed and doesn't exist after it processes it.

When reverse of OPTION is defined, processing opposite to a usual file rotation is done. After usual roteate, this is an option to want to return it.

  $e->rotate( ...... );
  my $fh= FileHandle->new("/path/to/save.txt") || do {
      $e->rotate( "/path/to/save.txt", reverse=> 1 );
      die $!;
    };

rotate_report

The report of the processing situation of the rotate method is returned.

  $e->rotate( ...... );
  .......
  ....
  print $e->rotate_report;

SEE ALSO

Top

Egg::Release,

AUTHOR

Top

Masatoshi Mizuno <lushe&64;cpan.org>

COPYRIGHT AND LICENSE

Top


Egg-Release documentation  | view source Contained in the Egg-Release distribution.