From 355d99d23241cfb2810eb4a0a7ed9cb728dbb005 Mon Sep 17 00:00:00 2001 From: Joe Cooper Date: Mon, 30 May 2016 18:48:25 -0700 Subject: [PATCH] strict/warn --- bind8/delete_view.cgi | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/bind8/delete_view.cgi b/bind8/delete_view.cgi index f45899f54..2de6b9498 100755 --- a/bind8/delete_view.cgi +++ b/bind8/delete_view.cgi @@ -1,24 +1,30 @@ #!/usr/local/bin/perl # delete_zone.cgi # Delete an existing view and all its zones +use strict; +use warnings; +# Globals +our (%access, %text, %in); require './bind8-lib.pl'; &ReadParse(); -$parent = &get_config_parent(); -$conf = $parent->{'members'}; -$vconf = $conf->[$in{'index'}]; +my $parent = &get_config_parent(); +my $conf = $parent->{'members'}; +my $vconf = $conf->[$in{'index'}]; $access{'views'} || &error($text{'view_ecannot'}); +my @zones; if (!$in{'confirm'}) { # Ask the user if he is sure .. &ui_print_header(undef, $text{'vdelete_title'}, ""); # Build input for moving zones to another view @zones = &find("zone", $vconf->{'members'}); + my $movefield; if (@zones) { - @moveopts = ( [ 0, $text{'vdelete_delete'} ], + my @moveopts = ( [ 0, $text{'vdelete_delete'} ], [ 1, $text{'vdelete_root'} ] ); - @views = &find("view", $conf); + my @views = &find("view", $conf); if (@views > 1) { push(@moveopts, [ 2, $text{'vdelete_move'}." ". &ui_select("newview", undef, @@ -44,6 +50,7 @@ if (!$in{'confirm'}) { # deal with the zones in this view @zones = &find("zone", $vconf->{'members'}); +my $dest; if ($in{'mode'} == 1) { # Adding to top level $dest = &get_config_parent(&add_to_file()); @@ -53,12 +60,12 @@ else { $dest = $conf->[$in{'newview'}]; } &lock_file(&make_chroot($dest->{'file'})); -foreach $z (@zones) { - local $type = &find_value("type", $z->{'members'}); +foreach my $z (@zones) { + my $type = &find_value("type", $z->{'members'}); next if (!$type || $type eq 'hint'); if ($in{'mode'} == 0) { # Delete the records file, and perhaps journal - local $f = &find_value("file", $z->{'members'}); + my $f = &find_value("file", $z->{'members'}); if ($f) { &delete_records_file($f->{'value'}); }