package PlainConfig; use strict; use Carp; use vars qw($AUTOLOAD); sub new{ my $self=shift; my $config=shift || croak "There is no path parameter specified"; my $new={}; open CONFIG, $config || croak "Couldn't open config file - $config"; while (){ s/^\s*//; next if (/^\s*#/ or /^$/); /^([^=\s]+)\s*=\s*([^\n\r]*)/; $new->{$1}=$2; } close CONFIG; bless $new, $self; return $new; } sub AUTOLOAD{ my $self=shift; my $attr=$AUTOLOAD; $attr=~s/(.*::)+//; return $self->{$attr}; } 1;