CfgTie

 view release on metacpan or  search on metacpan

CfgTie2.tex  view on Meta::CPAN


If this routine fails, it will make an attempt to restore things to their
original state and return.

@strong{Return Value}: 0 on success, -1 on error;

@subsubheading @code{Roll(}@emph{path},@emph{depth},@emph{sep}@code{)}

@cindex @code{Roll(}@emph{path},@emph{depth},@emph{sep}@code{)}

This convert the specified files into a backup file (the original file is
renamed, so you had better have something to put there).

@table @asis

@item @emph{Depth}
@cindex @emph{Depth}

(optional) Controlls the number of backup copies

@item @emph{Sep}
@cindex @emph{Sep}

(optional) Controlls the seperator between the main name and the backup
number

@end table

The defaults for @emph{depth} and @emph{sep} are controlled by following two variables
in the package:

@table @asis

@item @code{RollDepth}
@vindex @code{RollDepth}

Controlls the number of of older versions that are kept around as backup
copies.
@emph{@code{[}Default: 4@code{]}}

@item @code{RollSep}
@vindex @code{RollSep}

Controls the separator between the file name and the backup number.
@emph{@code{[}Default: }@code{~}@emph{@code{]}}

@end table

@subsubheading @code{RCS_path (}@emph{RCSObj},@emph{path}@code{)}

@cindex @code{RCS_path (}@emph{RCSObj},@emph{path}@code{)}

For the given RCS object, this sets the working directory and the file.

lib/CfgTie/filever.pm  view on Meta::CPAN


It preserves the permissions and ownership of the original file.

If this routine fails, it will make an attempt to restore things to their
original state and return.

B<Return Value>: 0 on success, -1 on error;

=head2 C<Roll(>I<path>,I<depth>,I<sep>C<)>

This convert the specified files into a backup file (the original file is
renamed, so you had better have something to put there).

=over 1

=item I<Depth>

(optional) Controlls the number of backup copies

=item I<Sep>

(optional) Controlls the seperator between the main name and the backup
number

=back

The defaults for I<depth> and I<sep> are controlled by following two variables
in the package:

=over 1

=item C<RollDepth>

Controlls the number of of older versions that are kept around as backup
copies.
I<[Default: 4]>

=item C<RollSep>

Controls the separator between the file name and the backup number.
I<[Default: >C<~>I<]>

=back

=head2 C<RCS_path (>I<RCSObj>,I<path>C<)>

For the given RCS object, this sets the working directory and the file.

=head2 find_by_user

lib/CfgTie/filever.pm  view on Meta::CPAN

{
   my($Old, $New) =  @_;
   if (!defined $Old) {die "Rotate: old not defined, but $New is!\n";}
   if ($Old eq $New) {return;}

   my @S =stat $Old;
   #If the old file does exist we need to do a bit of work (we use stat
   #since the other bits of information are relevant too)
   if (scalar @S)
     {
        #Migrate us to some backup copies, use one more than default so we
        #can unroll
        &Roll($Old,$RollDepth+1);

        # Modify the permissions of the new file to match that of the old one.
        if (!chmod($S[2], $New) ||

        # Modify the ownership of the new file to match that of the old one.
            !chown($S[4], $S[5], $New)||

            !rename($New, $Old))



( run in 0.462 second using v1.01-cache-2.11-cpan-49f99fa48dc )