perlancar

NAME

Filename::Backup - Check whether filename indicates being a backup file

VERSION

This document describes version 0.03 of Filename::Backup (from Perl distribution Filename-Backup), released on 2016-10-19.

SYNOPSIS

 use Filename::Backup qw(check_backup_filename);
 my $res = check_backup_filename(filename => "foo.txt~");
 if ($res) {
     printf "Filename indicates a backup, original name: %s\n",
         $res->{original_filename};
 } else {
     print "Filename does not indicate a backup\n";
 }

DESCRIPTION

FUNCTIONS

check_backup_filename(%args) -> bool|hash

Check whether filename indicates being a backup file.

This function is not exported by default, but exportable.

Arguments ('*' denotes required arguments):

  • ci => bool (default: 1)

    Whether to match case-insensitively.

  • filename* => str

Return value: (bool|hash)

Return false if not detected as backup name. Otherwise return a hash, which may contain these keys: original_filename. In the future there will be extra information returned, e.g. editor name (if filename indicates backup from certain backup program), date (if filename contains date information), and so on.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Filename-Backup.

SOURCE

Source repository is at https://github.com/perlancar/perl-Filename-Backup.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Filename-Backup

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

Filename::Archive

Filename::Compressed

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.