read_conf.pm v0.1.4
prime.conf改名为primedb.conf。
#!/usr/bin/perl
# file:read_conf.pm
# Get mysql user and password from the conf file:primedb.conf
# by:1e0n 05/10/28 v0.1.4
package read_conf;
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw($user $pwd);
open CONF,"primedb.conf" or die "can’t read file:primedb.conf";
foreach (<CONF>) {
chomp;
$user = $1 if /^user=(\S*)\s*$/;
$pwd = $1 if /^passward=(\S*)\s*$/;
}
1;