-
Website
http://inthebox.webmin.com -
Original page
http://inthebox.webmin.com/one-config-file-to-rule-them-all -
Subscribe
All Comments -
Community
-
Top Commenters
-
Do Follow
1 comment · 1 points
-
agence de communication
1 comment · 1 points
-
Apotheke
1 comment · 1 points
-
Alexandar Tzanov
2 comments · 1 points
-
ottomasi
1 comment · 1 points
-
-
Popular Threads
the perl should read:
###
my $file = "apache.config";
open(CONFIG, "< $file") or die "can't open $file: $!";
my %config = map {
s/#.*//; # Remove comments
s/^\s+//; # Remove opening whitespace
s/\s+$//; # Remove closing whitespace
m/(.*?)\s*=\s*(.*)/; }
;
# Print it out
use Data::Dumper;
print Dumper(\%config);
###
###
my $file = "apache.config";
open(CONFIG, "< $file") or die "can't open $file: $!";
while () {
chomp;
s/#.*//; # Remove comments
s/^\s+//; # Remove opening whitespace
s/\s+$//; # Remove closing whitespace
next unless length;
my ($key, $value) = split(/\s*=\s*/, $_, 2);
$config{$key} = $value;
}
# Print it out
use Data::Dumper;
print Dumper(\%config);
###
Christian
http://www.hm2k.com/posts/storing-mysql-databas...
It's mainly for use with PHP and Perl, but might work in other languages.