diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2008-06-17 17:15:26 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2008-06-17 17:15:26 +0000 |
commit | 1cde0c244a5bbe5a88390b327f5da3eae47909bb (patch) | |
tree | 311b150f6dfa06c7f34ece13f68435ea93105ff7 /modules/ConfigParser.pm | |
parent | 821e676d9ff0c53f73f99ed68bd0113bd3c62add (diff) | |
download | MPC-1cde0c244a5bbe5a88390b327f5da3eae47909bb.tar.gz |
ChangeLogTag: Tue Jun 17 17:16:07 UTC 2008 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'modules/ConfigParser.pm')
-rw-r--r-- | modules/ConfigParser.pm | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/modules/ConfigParser.pm b/modules/ConfigParser.pm index a6003521..4b4303b9 100644 --- a/modules/ConfigParser.pm +++ b/modules/ConfigParser.pm @@ -22,9 +22,8 @@ use vars qw(@ISA); # ************************************************************ sub new { - my($class) = shift; - my($valid) = shift; - my($self) = $class->SUPER::new(); + my($class, $valid) = @_; + my $self = $class->SUPER::new(); ## Set the values associative array $self->{'values'} = {}; @@ -36,17 +35,15 @@ sub new { sub parse_line { - my($self) = shift; - my($if) = shift; - my($line) = shift; - my($status) = 1; - my($error) = undef; + my($self, $if, $line) = @_; + my $status = 1; + my $error; if ($line eq '') { } elsif ($line =~ /^([^=]+)\s*=\s*(.*)$/) { - my($name) = $1; - my($value) = $2; + my $name = $1; + my $value = $2; $name =~ s/\s+$//; ## Pre-process the name and value @@ -76,26 +73,23 @@ sub parse_line { sub get_names { - my($self) = shift; - my(@names) = keys %{$self->{'values'}}; + my @names = keys %{$_[0]->{'values'}}; return \@names; } sub get_value { - my($self) = shift; - my($tag) = shift; + my($self, $tag) = @_; return $self->{'values'}->{$tag} || $self->{'values'}->{lc($tag)}; } sub preprocess { - my($self) = shift; - my($str) = shift; + my($self, $str) = @_; while($str =~ /\$([\(\w\)]+)/) { - my($name) = $1; + my $name = $1; $name =~ s/[\(\)]//g; - my($val) = $ENV{$name}; + my $val = $ENV{$name}; if (!defined $val) { $val = ''; if (!defined $self->{'warned'}->{$name}) { |