summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2005-05-17 16:50:30 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2005-05-17 16:50:30 +0000
commitebabc5692233c9029c87f8f3538182d8ced14aed (patch)
treefe32f0c0ba6fe29b90ba16d09359b4250881f86b
parentc32ab3192f92361786c3e36813e9906b5415a1c2 (diff)
downloadMPC-ebabc5692233c9029c87f8f3538182d8ced14aed.tar.gz
ChangeLogTag: Tue May 17 11:47:45 2005 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--ChangeLog8
-rw-r--r--modules/ProjectCreator.pm43
-rw-r--r--modules/TemplateParser.pm6
3 files changed, 39 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index fc145cd7..e58c7028 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue May 17 11:47:45 2005 Chad Elliott <elliott_c@ociweb.com>
+
+ * modules/ProjectCreator.pm:
+ * modules/TemplateParser.pm:
+
+ Fixed a bug where a template variable default would not be used if
+ the user set the template variable to empty.
+
Tue May 17 08:46:33 2005 Chad Elliott <elliott_c@ociweb.com>
* clone_build_tree.pl:
diff --git a/modules/ProjectCreator.pm b/modules/ProjectCreator.pm
index 26ea6e29..2462aede 100644
--- a/modules/ProjectCreator.pm
+++ b/modules/ProjectCreator.pm
@@ -3852,6 +3852,9 @@ sub adjust_value {
foreach my $val (@$addtemparr) {
my($arr) = $self->create_array($$val[1]);
if ($$val[0] > 0) {
+ if (!defined $value) {
+ $value = '';
+ }
if (UNIVERSAL::isa($value, 'ARRAY')) {
## We need to make $value a new array reference ($arr)
## to avoid modifying the array reference pointed to by $value
@@ -3864,31 +3867,35 @@ sub adjust_value {
}
elsif ($$val[0] < 0) {
my($parts) = undef;
- if (UNIVERSAL::isa($value, 'ARRAY')) {
- $parts = $value;
- }
- else {
- $parts = $self->create_array($value);
- }
+ if (defined $value) {
+ if (UNIVERSAL::isa($value, 'ARRAY')) {
+ $parts = $value;
+ }
+ else {
+ $parts = $self->create_array($value);
+ }
- $value = [];
- foreach my $part (@$parts) {
- if ($part ne '') {
- my($found) = 0;
- foreach my $ae (@$arr) {
- if ($part eq $ae) {
- $found = 1;
- last;
+ $value = [];
+ foreach my $part (@$parts) {
+ if ($part ne '') {
+ my($found) = 0;
+ foreach my $ae (@$arr) {
+ if ($part eq $ae) {
+ $found = 1;
+ last;
+ }
+ }
+ if (!$found) {
+ push(@$value, $part);
}
- }
- if (!$found) {
- push(@$value, $part);
}
}
}
}
else {
- $value = $arr;
+ ## If the user set the variable to empty, then we need to
+ ## set the value to undef
+ $value = (defined $$arr[0] ? $arr : undef);
}
}
last;
diff --git a/modules/TemplateParser.pm b/modules/TemplateParser.pm
index 90ebf637..5e591191 100644
--- a/modules/TemplateParser.pm
+++ b/modules/TemplateParser.pm
@@ -326,6 +326,12 @@ sub get_value_with_default {
}
$value = $self->{'prjc'}->relative(
$self->{'prjc'}->adjust_value([$sname, $name], $value));
+
+ ## If the user set the variable to empty, we will go ahead and use
+ ## the default value (since we know we have one at this point).
+ if (!defined $value) {
+ $value = $self->{'defaults'}->{$name};
+ }
}
else {
#$self->warning("$name defaulting to empty string.");