|
NAMEFile::BackupCopy - create a backup copy of the file.SYNOPSISuse File::BackupCopy; $backup_name = backup_copy($file_name); $backup_name = backup_copy($file_name, BACKUP_NUMBERED); $backup_name = backup_copy($file_name, type => BACKUP_NUMBERED, dir => $directory, error => \my $error); if (!$backup_name) { warn $error; } DESCRIPTIONThe File::BackupCopy module provides functions for creating backup copies of files. Normally, the name of the backup copy is created by appending a single "~" character to the original file name. This naming is called simple backup. Another naming scheme is numbered backup. In this scheme, the name of the backup is created by suffixing the original file name with ".~N~", where N is a decimal number starting with 1. In this naming scheme, the backup copies of file test would be called test.~1~, test.~2~ and so on.backup_copy$backup_name = backup_copy($orig_name); $backup_name = backup_copy($orig_name, $scheme); $backup_name = backup_copy($orig_name, %opts); The backup_copy function is the principal interface for managing backup copies. Its first argument specifies the name of the existing file for which a backup copy is required. Optional second argument controls the backup naming scheme. Its possible values are:
If the second argument is omitted, the function will consult the value of the environment variable VERSION_CONTROL. Its possible values are:
If VERSION_CONTROL is unset or set to any other value than those listed above, BACKUP_AUTO is assumed. The function returns the name of the backup file it created ("undef" if called with BACKUP_NONE). On error, it calls croak(). When used in the third form, the %opts are keyword arguments that control the function behavior. The following arguments are understood:
The following functions are available for using a specific backup naming scheme. These functions must be exported explicitly. backup_copy_simpleuse File::BackupCopy qw(backup_copy_simple); $backup_name = backup_copy_simple($orig_name, %opts); Creates simple backup. Optional %opts have the same meaning as in backup_copy, except that, obviously, type keyword is not accepted. backup_copy_numbereduse File::BackupCopy qw(backup_copy_numbered); $backup_name = backup_copy_numbered($orig_name, %opts); Creates numbered backup. See above for a description of %opts. backup_copy_autouse File::BackupCopy qw(backup_copy_auto); $backup_name = backup_copy_auto($orig_name, %opts); Creates numbered backup if any numbered backup version already exists for the file. Otherwise, creates simple backup. Optional %opts have the same meaning as in backup_copy, except that, obviously, type keyword is not accepted. LICENSEGPLv3+: GNU GPL version 3 or later, see <http://gnu.org/licenses/gpl.html>.This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. AUTHORSSergey Poznyakoff <gray@gnu.org>
Visit the GSP FreeBSD Man Page Interface. |