The smb.conf file is in a standard format popular with MS Windows and applications.for it. It will be no surprise that there is Config::IniFiles at CPAN to help parse them.
One More Really Round Wheel.
Update: That was too short. Here's a usage that gets you what you want:
There are provisions for rewriting the file, but you'll have to take care of locking yourself. There is also a tied interface, but I'd be leary of that without built-in file locks.use Config::IniFiles; my $smb = new Config::IniFiles( -file => '/etc/samba/smb.conf'); print join $/, $smb->Sections; # prints the section names
After Compline,
Zaxo
In reply to Re: hash reference
by Zaxo
in thread hash reference
by hotshot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |