DBIx-Easy
view release on metacpan or search on metacpan
}
}
return $self if $^O eq 'MSWin32';
# we may try to get password from DBMS specific
# configuration file
unless (defined $self->{PASS}) {
unless (defined $self->{'USER'}
&& $self->{'USER'} ne getpwuid($<)) {
$self->passwd();
}
}
return ($self);
}
# ------------------------------------------------------
# DESTRUCTOR
#
# implemented only for mysql
return unless $self->{'DRIVER'} eq 'mysql';
# makes sense only for the localhost
return if $self->{'HOST'};
# determine home directory
if (exists $ENV{'HOME'} && $ENV{'HOME'} =~ /\S/ && -d $ENV{'HOME'}) {
$mycnf = $ENV{'HOME'};
} else {
$mycnf = (getpwuid($>)) [7];
}
$mycnf .= '/.my.cnf';
# just give up if file is not accessible
open (CNF, $mycnf) || return;
while (<CNF>) {
# ignore comments and blank lines
next if /^\#/ or /^;/;
next unless /\S/;
# section ?
( run in 0.309 second using v1.01-cache-2.11-cpan-8d75d55dd25 )