NAME

File::Versions - Emacs-like versioned file names

SYNOPSIS

use File::Versions 'make_backup';
my $backup = make_backup ('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'.

DESCRIPTION

This module duplicates the behaviour of programs like the Emacs text editor under Unix, where the environment variables VERSION_CONTROL and SIMPLE_VERSION_CONTROL allow one to make numbered backups of a file.

backup_name

my $backup = backup_name ('file');

make_backup

make_backup ($file);

Make a backup of the file specified by $file.

This subroutine dies on error. If it succeeds, the return value is the name of the backup file.

SEE ALSO

There is something similar to this module in the source code of the "rename" utility which comes with Perl.

AUTHOR

Ben Bullock, bkb@cpan.org

COPYRIGHT & LICENCE

Copyright (c) 2010, 2013 Ben Bullock

You can use, modify and redistribute this software library under the standard Perl licences (Gnu General Public Licence or Artistic licence).