diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2006-08-09 01:20:44 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2006-08-09 01:20:44 +0000 |
commit | 03c7f64d05fe3dfab866499736f9a75ce8d0e399 (patch) | |
tree | 87f500e36475d7e727b65c3e90ad8f3a306392d6 /modules/Options.pm | |
parent | 09e54097d4098e9ef4d9a0996fff321435dd05dc (diff) | |
download | MPC-03c7f64d05fe3dfab866499736f9a75ce8d0e399.tar.gz |
ChangeLogTag: Wed Aug 9 01:14:54 UTC 2006 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'modules/Options.pm')
-rw-r--r-- | modules/Options.pm | 48 |
1 files changed, 13 insertions, 35 deletions
diff --git a/modules/Options.pm b/modules/Options.pm index 672f1a14..131f07c3 100644 --- a/modules/Options.pm +++ b/modules/Options.pm @@ -13,6 +13,7 @@ package Options; use strict; use DirectoryManager; +use StringProcessor; # ************************************************************ # Data Section @@ -454,25 +455,12 @@ sub options { $self->optionError('-value_template requires a variable assignment argument'); } else { - if ($value =~ /(\w+)\s*([\-+]?=)\s*(.*)/) { - my($name) = lc($1); - my($op) = $2; - my($val) = $3; - $val =~ s/^\s+//; - $val =~ s/\s+$//; - if ($op eq '+=') { - $op = 1; - } - elsif ($op eq '-=') { - $op = -1; - } - else { - $op = 0; - } - if (!defined $addtemp{$name}) { - $addtemp{$name} = []; - } - push(@{$addtemp{$name}}, [$op, $val]); + my(@values) = (); + if (StringProcessor::parse_assignment(undef, + $value, + \@values)) { + $addtemp{$values[1]} = [] if (!defined $addtemp{$values[1]}); + push(@{$addtemp{$values[1]}}, [$values[0], $values[2]]); } else { $self->optionError('Invalid argument to -value_template'); @@ -486,22 +474,12 @@ sub options { $self->optionError('-value_project requires a variable assignment argument'); } else { - if ($value =~ /(\w+)\s*([\-+]?=)\s*(.*)/) { - my($name) = lc($1); - my($op) = $2; - my($val) = $3; - $val =~ s/^\s+//; - $val =~ s/\s+$//; - if ($op eq '+=') { - $op = 1; - } - elsif ($op eq '-=') { - $op = -1; - } - else { - $op = 0; - } - $addproj{$name} = [$op, $val]; + my(@values) = (); + if (StringProcessor::parse_assignment(undef, + $value, + \@values)) { + $addproj{$values[1]} = [] if (!defined $addproj{$values[1]}); + push(@{$addproj{$values[1]}}, [$values[0], $values[2]]); } else { $self->optionError('Invalid argument to -value_project'); |