connection string is hardcoded

Hi,

I have many perl scripts in single server, i am new to perl,

suggestions are appreciated.

connection string is hardcoded in all perl scripts
i need to make change the all perl scripts and there should be only one config file available in that server.

destination database is mysql

How i can achive this.

Thanks in advance.

Prakash GR

Lots of information and examples out there on the Internet. Just search for "Perl configuration file"

Hi,


use DBI;
use Mail::Sendmail;
use MIME::QuotedPrint;
use HTML::Entities;
use POSIX qw(strftime);

$localtime1 = strftime("%e-%b-%Y %I:%M %p",localtime(time));
$localtime2 = strftime("%Y-%m-%d",localtime(time));

#definition of variables
$db="crms";
$host="203.187.192.91";
$user="ccc";
$password="adminccc";  # the root password

#connect to MySQL database
my $dbhpindb   = DBI->connect ("DBI:mysql:database=$db:host=$host",
                           $user,
                           $password)
                           or die "Can't connect to database: $DBI::errstr\n";


if (!$dbhpindb)
 {
    print "Can not connect to the database!";
    die "";
 }
	

There are many .pl files are there where i need to use config file instead of variables.

Thanks

Prakash

Hi,

any inputs.

Thanks
prakash