Skip to content

Commit

Permalink
support libconfig 1.7.3 by fetching each setting (should fix #13)
Browse files Browse the repository at this point in the history
  • Loading branch information
yrutschle committed Jul 27, 2021
1 parent 6b69447 commit c3fe07b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
@@ -1,3 +1,6 @@
2021-07-27
Support for libconfig 1.7.3

2021-07-22
Port PCRE from PCRE3 to new PCRE2. PCRE2 Posix API
seems to have become a mess in Debian 10 so moved to
Expand Down
17 changes: 13 additions & 4 deletions conf2struct
Expand Up @@ -48,15 +48,24 @@ my $conf = Conf::Libconfig->new;
my $filename = shift @ARGV;
die "Usage:\n\tconf2struct <file.cfg>\n" unless defined $filename;
$conf->read_file($filename) or die "$filename: $!\n";
my $hr = $conf->fetch_hashref("/");

my $header = $hr->{header};
my $parser = $hr->{parser};
my $printer = $hr->{printer} // 0;
my $header = $conf->lookup_value("header");
my $parser = $conf->lookup_value("parser");
my $printer = $conf->lookup_value("printer") // 0;

die "$filename: Setting for header filename is not defined\n" unless defined $header;
die "$filename: Setting for parser filename is not defined\n" unless defined $parser;

my $hr = {
header => $header,
parser => $parser,
printer => $printer,
conffile_option => $conf->fetch_array("conffile_option"),
includes => $conf->lookup_value("includes"),
config => $conf->fetch_hashref("config"),
cl_groups => $conf->fetch_array("cl_groups"),
};

# a bit of vocabulary:
# Schema: libconfig input file to the perl script which
# describes the data contained in the target configuration
Expand Down

0 comments on commit c3fe07b

Please sign in to comment.