From aac164fc48911b10e09b8d562e21aef90bad9699 Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Thu, 20 Dec 2007 17:32:19 -0800 Subject: Some checks for undefined references --- scripts/VyattaConfig.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'scripts/VyattaConfig.pm') diff --git a/scripts/VyattaConfig.pm b/scripts/VyattaConfig.pm index 6f99329..3a24579 100644 --- a/scripts/VyattaConfig.pm +++ b/scripts/VyattaConfig.pm @@ -190,8 +190,8 @@ sub returnOrigValue { # node is relative sub returnValues { my $val = returnValue(@_); - my @values; - if ($val) { + my @values = (); + if (defined($val)) { @values = split("\n", $val); } return @values; @@ -317,17 +317,16 @@ sub listNodeStatus { my ($self, $path) = @_; my @nodes = (); my %nodehash = (); - my $node = undef; # find deleted nodes first @nodes = $self->listDeleted("$path"); - foreach $node (@nodes) { + foreach my $node (@nodes) { if ($node =~ /.+/) { $nodehash{$node} = "deleted" }; } @nodes = (); @nodes = $self->listNodes("$path"); - foreach $node (@nodes) { + foreach my $node (@nodes) { if ($node =~ /.+/) { #print "DEBUG VyattaConfig->listNodeStatus(): node $node\n"; # No deleted nodes -- added, changed, ot static only. -- cgit v1.2.3