Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   editing smb.conf (INI files) (http://www.velocityreviews.com/forums/t907668-editing-smb-conf-ini-files.html)

Tomasz Chmielewski 06-30-2008 09:45 AM

editing smb.conf (INI files)
 
Anyone using Samba here? Or knows how an INI-file structure looks like?


What would you use to parse smb.conf or INI-files in a somehow
automated/scripted manner?


Let's say this is a part of smb.conf:

[homes]
valid users = user1, user2

[data]
valid users = user1, user2


And we want to add "user3" to "valid users" in [homes] in a script.


I've searched a bit and found some INI-file parsers, but they are
basically for extracting values, not editing/changing/adding them.

Are there any perl modules which help editing smb.conf or INI-files in
an automated/scripted way?


--
Tomasz Chmielewski
http://wpkg.org

Tomasz Chmielewski 06-30-2008 03:43 PM

Re: editing smb.conf (INI files)
 
Joe Smith schrieb:
> Tomasz Chmielewski wrote:
>> What would you use to parse smb.conf or INI-files in a somehow
>> automated/scripted manner?

>
> Config::Tiny - Read/Write .ini style files with as little code as possible
>
> # Changing data
> $Config->{newsection} = { this => 'that' }; # Add a section
> $Config->{section}->{Foo} = 'Not Bar!'; # Change a value
> delete $Config->{_}; # Delete a value or section
> # Save a config
> $Config->write( 'file.conf' );


Thanks a lot!


--
Tomasz Chmielewski
http://wpkg.org


All times are GMT. The time now is 10:10 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.