Make make-block.pl's output more flexible

This commit is contained in:
Dan Church 2021-07-23 16:09:38 -05:00
parent 2000a11c71
commit 2496f5c5a9
Signed by: h3xx
GPG key ID: EA2BF379CD2CDBD0

View file

@ -53,7 +53,7 @@ sub add_host_file {
}
MAIN: {
my $out = 'block.list';
my $out;
my $block_ip = '0.0.0.0';
my $workdir = &dirname($0);
@ -77,8 +77,11 @@ MAIN: {
}
my $written = 0;
open my $fho, '>', $out
my $fho = \*STDOUT;
if (defined $out && length $out) {
open $fho, '>', $out
or die "Failed to open file $out for writing: $!";
}
print $fho map {
++$written;
"$block_ip $_\n"