- BUGS AND LIMITATIONS
App::Hashl - Partially hash files, check if files are equal etc.
use App::Hashl; my $hashl = App::Hashl->new(); # or: App::Hashl->new_from_file($database_file);
This manual documents App::Hashl version 1.01
App::Hashl contains utilities to hash the first n bytes of files, store and recall them, check if another file is already in the database and optionally ignore file hashes.
- $hashl = App::Hashl->new(%conf)
Returns a new App::Hashl object. Accepted parameters are:
- $hashl = App::Hashl->new_from_file($file)
Returns the App::Hashl object saved to file by a prior $hashl->save call.
Returns bytes as a human-readable SI-size, such as "1.0k", "50.7M", "2.1G". The returned string is always six characters long.
Returns the SHA1 hash of the first few bytes (as configured via read_size) of file. Dies if file cannot be read.
Checks if hash is in the database. If it is, returns the filename it is associated with. If it is ignored, returns "// ignored" (subject to change). Otherwise, returns false.
Checks if file's hash is in the database. For the return value, see hash_in_db.
Returns the current read size. Note that once an App::Hashl object has been created, it is not possible to change the read size.
Returns a hashref describing the file. The layout is as follows:
hash => file's hash, mtime => mtime as UNIX timestamp, size => file size in bytes
If name does not exist in the database, returns undef.
Remove the file from the database.
Returns a list of all file names in the database.
Add a file to the database. Required keys in %data are:
- file => name
relateve file name to store in the database
- path => path
Full path to the file
- unignore => 0|1
If true: do not skip ignored files, unignore and re-add them instead
If the file already is in the database, it is only updated if both the file size and the mtime have changed.
Returns true if the file was actually added to the database, false if it is ignored or already present (and up-to-date).
Returns a list of all ignored file hashes.
- $hashl->ignore($file, $path)
Removes $file from the database and adds $path to the list of ignored file hashes.
Unignore the hash of $path.
Save the App::Hashl object with all data to $file. It can later be retrieved via new_from_file.
Copyright (C) 2011-2017 by Daniel Friesel <firstname.lastname@example.org>
0. You just DO WHAT THE FUCK YOU WANT TO.