Oh so easy just watch. You change name of subroutine to connect_multiple and add sitemap liek this: You just watch so easy! xD
sub connect {
my %site_map = (
Bang => [ qw(rate_bang_current) ],
Nor => [ qw(rate_nor_current) ],
Wilming => [ qw(rate_wilming_current) ],
Lime => [ qw(rate_lime_current) ],
);
$host = "dev.sp1.wilinlog.com";
$database = "rate_bang_current" ;
$user = "senthom" ;
$pw = "ask123";
my $dsn = "DBI:mysql:host=$host";
my $dbh = DBI->connect($dsn, $user, $pw) ||
die "ERROR: can't connect to database server\n";
return $dbh;
$host = "dev.sp1.wilinlog.com";
$database = "rate_nor_current" ;
$user = "senthom" ;
$pw = "ask123";
my %site_map = (
Bang => [ qw(rate_bang_current) ],
Nor => [ qw(rate_nor_current) ],
Wilming => [ qw(rate_wilming_current) ],
Lime => [ qw(rate_lime_current) ],
);
my $dsn = "DBI:mysql:host=$host";
my $dbh = DBI->connect($dsn, $user, $pw) ||
die "ERROR: can't connect to database server\n";
return $dbh;
$host = "dev.sp1.wilinlog.com";
$database = "rate_wilming_current" ;
$user = "senthom" ;
$pw = "ask123";
my %site_map = (
Bang => [ qw(rate_bang_current) ],
Nor => [ qw(rate_nor_current) ],
Wilming => [ qw(rate_wilming_current) ],
Lime => [ qw(rate_lime_current) ],
);
my $dsn = "DBI:mysql:host=$host";
my $dbh = DBI->connect($dsn, $user, $pw) ||
die "ERROR: can't connect to database server\n";
return $dbh;
$host = "dev.sp1.wilinlog.com";
$database = "rate_lime_current" ;
$user = "senthom" ;
$pw = "ask123";
my %site_map = (
Bang => [ qw(rate_bang_current) ],
Nor => [ qw(rate_nor_current) ],
Wilming => [ qw(rate_wilming_current) ],
Lime => [ qw(rate_lime_current) ],
);
my $dsn = "DBI:mysql:host=$host";
my $dbh = DBI->connect($dsn, $user, $pw) ||
die "ERROR: can't connect to database server\n";
return $dbh;
}
|