- SEE ALSO
- COPYRIGHT & LICENCE
File::Versions - Emacs-like versioned file names
use FindBin '$Bin'; use File::Versions 'make_backup'; my $backup = make_backup ("$Bin/file"); # If the environment variable 'VERSION_CONTROL' is set to # 'numbered', 'file' is moved to 'file.~1~'. The value of the new # file name is put into '$backup'.
This documents File::Versions version 0.09 corresponding to git commit 7d641410d8d898ad7292d9eaf531614fea033e59 released on Sat May 12 10:40:28 2018 +0900.
This module duplicates the behaviour of programs like the Emacs text editor under Unix, where the environment variables
SIMPLE_VERSION_CONTROL allow one to make numbered backups of a file.
my $backup = backup_name ('file');
Make an appropriate numbered backup name for file. The return value is this name.
Make a backup of the file specified by file, by renaming file to its backup name, as given by "backup_name". If such a file already exists, delete it using
unlink before renaming
This subroutine dies using "croak" in Carp on error. If it succeeds, the return value is the name of the backup file.
There is something similar to this module in the source code of the "rename" utility which comes with Perl.
use utf8; use FindBin '$Bin'; use File::Versions ':all';
Ben Bullock, <firstname.lastname@example.org>
This package and associated files are copyright (C) 2010-2018 Ben Bullock.
You can use, copy, modify and redistribute this package and associated files under the Perl Artistic Licence or the GNU General Public Licence.