in reply to Re: Config file
in thread Config file
Seriously, everyone? More than 90% of config files are simple and can be processed in two lines of code (not counting formatting). Like this...open a file, and parse the lines with a map:
open( my $config_fh, '< :encoding(UTF-8)', '/some/path/.tofile' ) or die "$0: Can't open config file. $!\n"; my %creds = map { $_ =~ /(\S+)\s*?:\s*?(\S+)/ } <$config_fh>;
This will hande those simple key/value config lines:
key: value
But at the end of the day, I would also say "standardize on a common CPAN module..."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Config file
by kschwab (Vicar) on Oct 30, 2014 at 22:39 UTC |