Logfile-Rotate

 view release on metacpan or  search on metacpan

Logfile-Rotate.man.html  view on Meta::CPAN

<P>The <CODE>Signal</CODE> argument is deprecated by the <CODE>Post</CODE> argument.</P>
<P>The <CODE>Flock</CODE> argument allows you to specify whether the perl function
<CODE>flock</CODE> is used to lock the file during the rotation operation.
Apparently flock causes problems on some platforms and this option has
been added to allow you to control the programs behaviour.  By default
the file will be locked using <CODE>flock</CODE>.</P>
<P>The <CODE>Persist</CODE> argument allows you to control whether the program will
try and set the current log file ownership and permissions on any new
files that may be created by the rotation.  In some circumstances the
program doing the file rotation may not have sufficient permission to
<CODE>chown</CODE> on the file.  By default the program will try and preserve
ownership and permissions.</P>
<P></P>
<DT><STRONG><A NAME="item_rotate"><CODE>rotate()</CODE></A></STRONG><BR>
<DD>
This method will copy the file passed in <A HREF="#item_new"><CODE>new</CODE></A> to a file of the same
name, with a numeric extension and truncate the original file to zero
length.  The numeric extension will range from 1 up to the value
specified by Count, or 7 if none is defined, with 1 being the most
recent file.  When Count is reached, the older file is discarded in a
FIFO (first in, first out) fashion. If the argument <CODE>Dir</CODE> was given, 

README  view on Meta::CPAN

        The `Flock' argument allows you to specify whether the perl function
        `flock' is used to lock the file during the rotation operation.
        Apparently flock causes problems on some platforms and this option
        has been added to allow you to control the programs behaviour. By
        default the file will be locked using `flock'.

        The `Persist' argument allows you to control whether the program
        will try and set the current log file ownership and permissions on
        any new files that may be created by the rotation. In some
        circumstances the program doing the file rotation may not have
        sufficient permission to `chown' on the file. By default the program
        will try and preserve ownership and permissions.

    rotate()
        This method will copy the file passed in `new' to a file of the same
        name, with a numeric extension and truncate the original file to
        zero length. The numeric extension will range from 1 up to the value
        specified by Count, or 7 if none is defined, with 1 being the most
        recent file. When Count is reached, the older file is discarded in a
        FIFO (first in, first out) fashion. If the argument `Dir' was given,
        all old files will be placed in the specified directory.

Rotate.pm  view on Meta::CPAN


    ## copy current to next incremental
    $next = "${currn}.1";
    copy ($curr, $next);        

	## preserve permissions and status
	if ( $self->{'Persist'} eq 'yes' ){
		my @stat = stat $curr;
		chmod( $stat[2], $next ) or carp "error: chmod failed: ($next)";
		utime( $stat[8], $stat[9], $next ) or carp "error: failed: ($next)";
		chown( $stat[4], $stat[5], $next ) or carp "error: chown failed: ($next)";
	}

    # now truncate the file
	if( $self->{'Flock'} eq 'yes' )
	{
		truncate $curr,0 or croak "error: could not truncate $curr: $!"; }
	else{
		local(*IN);
		open(IN, "+>$self->{'File'}") 
			or croak "error: could not truncate $curr: $!";

Rotate.pm  view on Meta::CPAN

The C<Flock> argument allows you to specify whether the perl function
C<flock> is used to lock the file during the rotation operation.
Apparently flock causes problems on some platforms and this option has
been added to allow you to control the programs behaviour.  By default
the file will be locked using C<flock>.

The C<Persist> argument allows you to control whether the program will
try and set the current log file ownership and permissions on any new
files that may be created by the rotation.  In some circumstances the
program doing the file rotation may not have sufficient permission to
C<chown> on the file.  By default the program will try and preserve
ownership and permissions.

=item rotate()

This method will copy the file passed in C<new> to a file of the same
name, with a numeric extension and truncate the original file to zero
length.  The numeric extension will range from 1 up to the value
specified by Count, or 7 if none is defined, with 1 being the most
recent file.  When Count is reached, the older file is discarded in a
FIFO (first in, first out) fashion. If the argument C<Dir> was given, 



( run in 0.563 second using v1.01-cache-2.11-cpan-71847e10f99 )