config file modules confusion

config file modules confusion

am 08.02.2011 03:11:01 von Jim Green

Hello
I searched cpan and was overwhelmed by the number of modules
available.

I want a config module that can do updates well, preserving formats of
original file, preserving blank lines, comments, etc. which one should
I use..?

Config::General, Config::Simple, Config::Inifiles, just to name a
few..

Thanks!
Jim


--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: config file modules confusion

am 08.02.2011 04:07:07 von terry peng

Mon, 7 Feb 2011 18:11:01 -0800 (PST) ÐÉÓØÍÏ ÏÔ Jim Green :

> Hello
> I searched cpan and was overwhelmed by the number of modules
> available.
>
> I want a config module that can do updates well, preserving formats of
> original file, preserving blank lines, comments, etc. which one should
> I use..?
>
> Config::General, Config::Simple, Config::Inifiles, just to name a
> few..
>

I had used Config::Simple which I think is the right module for parsing a config file.

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: config file modules confusion

am 08.02.2011 07:45:59 von Owen

On Mon, 7 Feb 2011 18:11:01 -0800 (PST)
Jim Green wrote:

> Hello
> I searched cpan and was overwhelmed by the number of modules
> available.
>
> I want a config module that can do updates well, preserving formats of
> original file, preserving blank lines, comments, etc. which one should
> I use..?
>
> Config::General, Config::Simple, Config::Inifiles, just to name a
> few..



I have used Config::General, its fine and easy to usse.



owen

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: config file modules confusion

am 08.02.2011 10:13:02 von Shlomi Fish

Hi Jim,

On Tuesday 08 Feb 2011 04:11:01 Jim Green wrote:
> Hello
> I searched cpan and was overwhelmed by the number of modules
> available.
>

Yes, there are many Config:: files around. A prominent Israeli Perl Monger has
given an entertaining presentation on this subject in a Tel Aviv meeting
comparing it to Alenby Street in Tel Aviv (the reference would be lost to non-
locals and was not obvious to us when we heard of it.). The slides are not
online unfortunately.

> I want a config module that can do updates well, preserving formats of
> original file, preserving blank lines, comments, etc. which one should
> I use..?
>
> Config::General, Config::Simple, Config::Inifiles, just to name a
> few..
>

I believe (but am not entirely sure) that Config::IniFiles goes to great
lengths to make sure comments and possibly also white space are preserved and
can even be manipulated or changed. It should also preserve the order of the
keys in the file, assuming there are no duplicate keys.

I should note that I'm the current Config-Inifiles maintainer, and have done
quite a lot of work on it recently, that involved modernising the test suite's
code, applying patches, etc. The internals of Config-IniFiles are somewhat
messy and suffer from some ancient Perl issues, and the test suite may not be
comprehensive, but it should work fine for most people, and we'll handle any
issue reported on the rt.cpan.org bug tracker given at least a reproducible
test case.

Also see:

http://blogs.perl.org/users/steven_haryanto/2010/11/comparis on-of-ini-format-
modules-on-cpan.html

(short URL - http://xrl.us/bihrdb ).

Of course, don't take my word for it, and write some test cases to see that
everything works fine. This is assuming you won't find the INI-file format
(which is limited to two levels) too restrictive.

Good luck!

Regards,

Shlomi Fish

--
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
My Favourite FOSS - http://www.shlomifish.org/open-source/favourite/

Chuck Norris can make the statement "This statement is false" a true one.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/