App-Hashl
view release on metacpan or search on metacpan
my $build = Module::Build->new(
build_requires => {
'Test::More' => 0,
'Test::Compile' => 0,
'Test::Pod' => 0,
},
module_name => 'App::Hashl',
license => 'unrestricted',
requires => {
'perl' => '5.10.0',
'DateTime' => 0,
'Digest::SHA' => 0,
'File::Copy' => 0,
'File::Find' => 0,
'Getopt::Long' => 0,
'IO::Handle' => 0,
'List::MoreUtils' => 0,
'Storable' => 0,
'Time::Progress' => 0,
},
script_files => 'bin/',
hashl 1.01 - Sun Jan 08 2017
* You can now use -s 0 / --read-size=0 to hash entire files
* New option: -e <file> / --extra-db=<file>
* New option: -x / --one-file-system
* New command: "hashl ls" lists files using an ls-style output format
* Fix find-new and find-known output so it can be piped to other commands
* New dependencies: DateTime and List::MoreUtils
hashl 1.00 - Wed Nov 02 2011
* Add "hashl list <regex>" to filter listed files by name
* Do not fail when encountering zero-length files
hashl 0.2 - Mon May 23 2011
* The internal representation of ignored hashes was changed
* hashl update no longer re-adds ignored (but existing) files
"Test::Pod" : "0"
}
},
"configure" : {
"requires" : {
"Module::Build" : "0.42"
}
},
"runtime" : {
"requires" : {
"DateTime" : "0",
"Digest::SHA" : "0",
"File::Copy" : "0",
"File::Find" : "0",
"Getopt::Long" : "0",
"IO::Handle" : "0",
"List::MoreUtils" : "0",
"Storable" : "0",
"Time::Progress" : "0",
"perl" : "v5.10.0"
}
license: unrestricted
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: App-Hashl
provides:
App::Hashl:
file: lib/App/Hashl.pm
version: '1.01'
requires:
DateTime: '0'
Digest::SHA: '0'
File::Copy: '0'
File::Find: '0'
Getopt::Long: '0'
IO::Handle: '0'
List::MoreUtils: '0'
Storable: '0'
Time::Progress: '0'
perl: v5.10.0
version: '1.01'
hashl - Create database with partial file hashes, check if other files are in it
--------------------------------------------------------------------------------
* <https://finalrewind.org/projects/hashl/>
Dependencies
------------
* perl version 5.10 or newer
* DateTime
* Digest::SHA
* List::MoreUtils
* Time::Progress
Installation
------------
$ perl Build.PL
$ perl Build
$ sudo perl Build install
## License: WTFPL <http://sam.zoy.org/wtfpl>
## 0. You just DO WHAT THE FUCK YOU WANT TO.
use strict;
use warnings;
use 5.010;
no if $] >= 5.018, warnings => 'experimental::smartmatch';
use App::Hashl;
use Cwd;
use DateTime;
use File::Copy;
use File::Find;
use Getopt::Long;
use IO::Handle;
use List::MoreUtils qw(any);
use Time::Progress;
my $add_unignore = 0;
my $base = getcwd();
my $rel_paths = 1;
my $filetype = ( split( qr{ [.] }x, $filename ) )[-1];
if ( exists $cmap->{$filetype} ) {
return sprintf( "\e[%sm%s\e[0m", $cmap->{$filetype}, $filename );
}
return $filename;
}
sub cmd_ls {
my ($re) = @_;
my $now = DateTime->now;
ensure_equal_hash_sizes();
my @ls_colors = split( qr{ : }x, $ENV{LS_COLORS} // q{} );
my %cmap;
for my $ls_color (@ls_colors) {
if ( $ls_color =~ m{ ^ [*] [.] (?<filetype> [^=]+ ) = (?<color> .+) }x )
{
$cmap{ $+{filetype} } = $+{color};
}
}
for my $pair (
sort { $a->[1] cmp $b->[1] }
map { map_with_prefix( $_, $_->files ) } @ehashl
)
{
my ( $db, $name ) = @{$pair};
my $file = $db->file($name);
my $dt = DateTime->from_epoch(
epoch => $file->{mtime},
);
my $time_format = '%b %d %H:%M';
# Date math is hard. So we don't account for leap years (or leap seconds) here.
if ( $now->epoch - $dt->epoch >= 31536000 ) {
$time_format = '%b %d %Y';
}
if ( $re and $name !~ m{$re} ) {
( run in 0.337 second using v1.01-cache-2.11-cpan-05444aca049 )