28 |
@ISA = qw(Libconf); |
@ISA = qw(Libconf); |
29 |
|
|
30 |
sub new { |
sub new { |
31 |
my ($pkg, $filename) = @_; |
my ($class, $filename, $data_description, $data_mapping) = @_; |
32 |
my $libconf = Libconf::new('Libconf', $filename, 'shell', ''); |
my $libconf = Libconf::new('Libconf', $filename, 'shell', ''); |
33 |
tie my %wrapper, 'Libconf::Glueconf::Shell::Wrapper', $libconf; |
tie my %wrapper, 'Libconf::Glueconf::Shell::Wrapper', $libconf, $data_description, $data_mapping; |
34 |
bless \%wrapper, $pkg; |
bless \%wrapper, $class; |
35 |
} |
} |
36 |
|
|
37 |
sub readConf { |
sub readConf { |
49 |
sub debug { Libconf::debug(@_) } |
sub debug { Libconf::debug(@_) } |
50 |
|
|
51 |
sub TIEHASH { |
sub TIEHASH { |
52 |
my ($pkg, $libconf) = @_; |
my ($pkg, $libconf, $data_description, $data_mapping) = @_; |
53 |
debug; |
debug; |
54 |
bless { libconf => $libconf }, $pkg; |
bless { |
55 |
|
libconf => $libconf, |
56 |
|
_data_description => $data_description, |
57 |
|
_data_mapping => $data_mapping, |
58 |
|
}, $pkg; |
59 |
} |
} |
60 |
|
|
61 |
sub CLEAR { |
sub CLEAR { |
113 |
my ($obj, $key) = @_; |
my ($obj, $key) = @_; |
114 |
debug "key : $key"; |
debug "key : $key"; |
115 |
$key eq 'libconf' and return $obj->{libconf}; |
$key eq 'libconf' and return $obj->{libconf}; |
116 |
|
substr($key, 0, 1) eq '_' and return $obj->{$key}; |
117 |
my @pos = $obj->{libconf}->findAtomPos({ type => 'KEY_VALUE', key => $key }); |
my @pos = $obj->{libconf}->findAtomPos({ type => 'KEY_VALUE', key => $key }); |
118 |
|
@pos == 0 and return undef; |
119 |
$obj->{libconf}->getAtom($pos[-1])->{value}; |
$obj->{libconf}->getAtom($pos[-1])->{value}; |
120 |
} |
} |
121 |
|
|