summaryrefslogtreecommitdiff
path: root/scripts/VyattaConfig.pm
diff options
context:
space:
mode:
authorMarat Nepomnyashy <marat@eng-158.vyatta.com>2007-12-18 16:48:07 -0800
committerMarat Nepomnyashy <marat@eng-158.vyatta.com>2007-12-18 16:48:07 -0800
commitf437c62e5429f03aff962ca5885be8057359d75e (patch)
tree8d98d99ba5814ec2f10c75df16ddc43324a694fe /scripts/VyattaConfig.pm
parent7966b8cf00e08548447e551a3fcfde40aa06cc59 (diff)
downloadvyatta-cfg-f437c62e5429f03aff962ca5885be8057359d75e.tar.gz
vyatta-cfg-f437c62e5429f03aff962ca5885be8057359d75e.zip
Cleaned up several routines to not generate warnings with 'perl -w' in order to be able to call them from scripts that use 'perl -w'.
Diffstat (limited to 'scripts/VyattaConfig.pm')
-rw-r--r--scripts/VyattaConfig.pm27
1 files changed, 15 insertions, 12 deletions
diff --git a/scripts/VyattaConfig.pm b/scripts/VyattaConfig.pm
index 9b1b933..4d0a90c 100644
--- a/scripts/VyattaConfig.pm
+++ b/scripts/VyattaConfig.pm
@@ -121,15 +121,15 @@ sub listOrigNodes {
# for example
sub returnParent {
my ($self, $node) = @_;
- my $x, my $tmp;
+ my @x, my $tmp;
# split our hierarchy into vars on a stack
my @level = split /\s+/, $self->{_level};
# count the number of parents we need to lose
# and then pop 1 less
- $x = split /\s+/, $node;
- for ($tmp = 1; $tmp < $x; $tmp++) {
+ @x = split /\s+/, $node;
+ for ($tmp = 1; $tmp < @x; $tmp++) {
pop @level;
}
@@ -190,7 +190,10 @@ sub returnOrigValue {
# node is relative
sub returnValues {
my $val = returnValue(@_);
- my @values = split("\n", $val);
+ my @values;
+ if ($val) {
+ @values = split("\n", $val);
+ }
return @values;
}
@@ -299,7 +302,7 @@ sub listDeleted {
# get rid of the whiteout prefix
my $dir_opq = 0;
foreach $node (@nodes) {
- $node =~ s/^\.wh\.(.+)/\1/;
+ $node =~ s/^\.wh\.(.+)/$1/;
$_ = $node;
if (! /__dir_opaque/) {
push @return, $node;
@@ -327,7 +330,7 @@ sub isChanged {
# let's setup the filepath for the change_dir
$node =~ s/\//%2F/g;
- $node =~ s/\s+/\//g, $node;
+ $node =~ s/\s+/\//g;
my $filepath = "$self->{_changes_only_dir_base}$self->{_current_dir_level}/$node";
# if the node exists in the change dir, it's modified.
@@ -344,20 +347,20 @@ sub isAdded {
#print "DEBUG VyattaConfig->isAdded(): node $node\n";
# let's setup the filepath for the modify dir
$node =~ s/\//%2F/g;
- $node =~ s/\s+/\//g, $node;
- my $filepath = "$self->{_new_config_dir_base}$self->{_current_dir_level}/$node";
+ $node =~ s/\s+/\//g;
+ my $filepathNewConfig = "$self->{_new_config_dir_base}$self->{_current_dir_level}/$node";
- #print "DEBUG VyattaConfig->isAdded(): filepath $filepath\n";
+ #print "DEBUG VyattaConfig->isAdded(): filepath $filepathNewConfig\n";
# if the node doesn't exist in the modify dir, it's not
# been added. so short circuit and return false.
- if (! -e "$filepath") { return 0; }
+ if (! -e $filepathNewConfig) { return 0; }
# now let's setup the path for the working dir
- my $filepath = "$self->{_active_dir_base}$self->{_current_dir_level}/$node";
+ my $filepathActive = "$self->{_active_dir_base}$self->{_current_dir_level}/$node";
# if the node is in the active_dir it's not new
- if (-e "$filepath") { return 0; }
+ if (-e $filepathActive) { return 0; }
else { return 1; }
}