--- a/bin/dnsvi Fri May 23 11:46:36 2014 +0200
+++ b/bin/dnsvi Fri May 23 11:48:42 2014 +0200
@@ -3,7 +3,7 @@
use 5.010;
use strict;
use warnings;
-use if $ENV{DEBUG}//'' eq 'dnsvi' => 'Smart::Comments';
+use if $ENV{DEBUG} // '' eq 'dnsvi' => 'Smart::Comments';
use File::Temp;
use Getopt::Long;
use Pod::Usage;
@@ -15,13 +15,13 @@
my %o = (
key => undef,
server => undef,
- debug => undef,
+ debug => undef,
);
GetOptions(
'k|key=s' => \$o{key},
's|server=s' => \$o{server},
- 'd|debug!' => \$o{debug},
+ 'd|debug!' => \$o{debug},
)
&& @ARGV == 1
or pod2usage();
@@ -46,28 +46,34 @@
my @zone2 = parse(<$tmp>);
my ($add, $del) = delta(\@zone1, \@zone2);
- my $orig_soa = (grep { $_->{rrtype} eq 'SOA' } map { $_->{rrset} } @zone1)[0];
+ my $orig_soa =
+ (grep { $_->{rrtype} eq 'SOA' } map { $_->{rrset} } @zone1)[0];
my @cmds = (
- # 'prereq yxrrset {domain-name} [class] {type} {data…',
- "prereq yxrrset @{$orig_soa}{qw{label rrtype data}}",
- (map { "update add $_" } @$add),
- (map { "update delete $_" } @$del));
+
+ # 'prereq yxrrset {domain-name} [class] {type} {data…',
+ "prereq yxrrset @{$orig_soa}{qw{label rrtype data}}",
+ (map { "update add $_" } @$add),
+ (map { "update delete $_" } @$del)
+ );
print <<_EOF, join "\n" => @cmds, '';
# The following commands are about to be sent via nsupdate
# to the master server:
_EOF
-print '# Please confirm (yes/no): ';
-return 1 if <STDIN> ne "yes\n";
+ print '# Please confirm (yes/no): ';
+ return 1 if <STDIN> ne "yes\n";
- my @nsupdate = ('nsupdate', defined $o{debug} ? ('-d') : (), defined $o{key} ? (-k => $o{key}) : ());
+ my @nsupdate = (
+ 'nsupdate',
+ defined $o{debug} ? ('-d') : (),
+ defined $o{key} ? (-k => $o{key}) : ()
+ );
open(my $nsupdate, '|-') or do {
- exec @nsupdate;
- die "Can't exec @nsupdate: $!\n";
+ exec @nsupdate;
+ die "Can't exec @nsupdate: $!\n";
};
- say $nsupdate join "\n", @cmds,
- 'show', 'send', 'answer';
+ say $nsupdate join "\n", @cmds, 'show', 'send', 'answer';
close($nsupdate);
say "nsupdate returned $?";
return 0;