perl - AppConfig::File retrieving values -
perl - AppConfig::File retrieving values -
i trying utilize appconfig::file handling config file. however, getting empty value object. next code:
my $state = appconfig::state->new( { create=>1, } ); $cfgfile = appconfig::file->new($state); $cfgfile->parse('sample.cfg'); $temp = $cfgfile->{foo}; print "foo value: $temp\n";
this in sample.cfg:
## comment foo = me
what did wrong? in advance.
the solution include argcount setting in definition of variable. not sure how dynamically file.
use warnings; utilize strict; utilize appconfig ':argcount'; utilize appconfig::file; $state = appconfig::state->new( { create=>1, } ); $state->define('foo', { argcount => argcount_one }); $cfgfile = appconfig::file->new($state); $cfgfile->parse('sample.cfg'); print "state value: '", $state->foo(), "'\n";
perl configuration app-config
Comments
Post a Comment