Require Perl 5.12

Fix some postfix 'if' statements too.
This commit is contained in:
Dan Church 2023-09-04 10:50:30 -05:00
parent 133b271208
commit 7d9188c6fa
Signed by: h3xx
GPG Key ID: EA2BF379CD2CDBD0
1 changed files with 16 additions and 6 deletions

View File

@ -13,7 +13,7 @@
# You may NOT use this software for commercial purposes.
###############################################################################
use strict;
use 5.012;
use warnings;
use Getopt::Long qw/ GetOptions :config no_ignore_case /;
@ -27,7 +27,9 @@ sub add_domain_list {
my $file = shift;
foreach my $line (read_stripped($file)) {
my $domain = lc $line;
++$dupes if defined $domains{$domain};
if (defined $domains{$domain}) {
++$dupes;
}
$domains{$domain} = 1;
}
}
@ -47,7 +49,9 @@ sub add_host_file {
next;
}
my $domain = lc $parts[1];
++$dupes if defined $domains{$domain};
if (defined $domains{$domain}) {
++$dupes;
}
$domains{$domain} = 1;
}
}
@ -117,7 +121,13 @@ MAIN: {
printf STDERR "%d domains written to %s from\n", $written, $out // 'STDOUT';
printf STDERR " - %d .domains files\n", (scalar @domain_lists);
printf STDERR " - %d .hosts files\n", (scalar @hosts_lists);
printf STDERR "(%d duplicates)\n", $dupes if $dupes;
printf STDERR "(%d domains removed via allowlist)\n", $removed_allowed if $removed_allowed;
printf STDERR "(%d skipped)\n", $skip if $skip;
if ($dupes) {
say STDERR "($dupes duplicates)";
}
if ($removed_allowed) {
say STDERR "($removed_allowed domains removed via allowlist)";
}
if ($skip) {
say STDERR "($skip skipped)";
}
}