I'm trying to read some third party INI files using
I'm using the latest Config::IniFiles v2.52 with perl v5.8.8.
I've never used Config::IniFiles before.
Given a simple example third party INI file, fred.ini, as follows:
running this program:
my $cfg = Config::IniFiles->new( -file => 'fred.ini' )
or die "error: IniFiles->new: @Config::IniFiles::errors";
my @values = $cfg->val( 'Trace', 'TRACE_MODULE' );
print Dumper( \@values );
$cfg->WriteConfig( 'fred2.ini' )
or die "error: WriteConfig: $!\n";
$VAR1 = [
and produces a new ini file, fred2.ini, as follows:
That is, Config::IniFiles seems to read the INI file ok, but writes
it out in a different "<<EOT here document" format.
I need the new INI file to be written in its original format.
Otherwise, the third party application is unable to read the
updated INI files that I produce.
From reading the Config::IniFiles docs, it's unclear to me whether
the third party multi-valued parameter INI file format, namely:
is officially supported. Though Config::IniFiles seems to read this
format happily enough, it's not mentioned in its docs and I can see
no way to make WriteConfig() emit a multi-valued parameter in this format.
There are many ways I could solve this problem.
I could raise a Config::IniFiles ticket/patch enhancing this module to
handle my third party multi-value parameter format.
Or look for a different INI file module, write my own, ...
Suggestions on how to solve my problem are welcome.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] |