$key is |dbhost| and $value is |localhost.localdomain| or |localhost.localdomain|.
localhost.localdomain
$key is |dbuser| and $value is |user| or |user|.
user
####
Use of uninitialized value in string at ./cache-riding-pages.pl line 26.
Use of uninitialized value in string at ./cache-riding-pages.pl line 27.
Use of uninitialized value in string at ./cache-riding-pages.pl line 28.
Use of uninitialized value in string at ./cache-riding-pages.pl line 29.
####
#!/usr/bin/perl -w
use strict;
use DBI;
my(%conf);
my $config = "/path/to/conf/config.php";
my($dbh,$sql,$sth,$key,$value);
open(CONF,$config);
while () {
if(m/\=/ && m/db/){
($key,$value) = split(/ \= /,$_);
chomp($key); chomp($value);
$key =~ s/\$//;
$value =~ s/\"//g;
$value =~ s/\;//;
$conf{'$key'} = $value;
print "\$key is |$key| and \$value is |$value| or |$conf{'$key'}|.\n";
print $conf{'$key'};
}
}
close CONF;
# values %conf;
# $dbh = ed_connect($conf{'dbhost'}, $conf{'dbname'}, $conf{'dbuser'}, $conf{'dbpass'});
print "$conf{'dbhost'}";
print "$conf{'dbname'}";
print "$conf{'dbuser'}";
print "$conf{'dbpass'}";
# $dbh = connect('localhost', $conf{'dbname'}, $conf{'dbuser'}, $conf{'dbpass'});
exit;
1;
sub ed_connect {
my($host_name,$db_name,$db_user,$db_pass)=@_;
my $dsn = "DBI:mysql:host=$host_name;database=$db_name";
return (DBI->connect($dsn,$db_user,$db_pass),
{PrintError => 0, RaiseError => 1});
}