Hello!
I just experienced some odd behavior with DBD::Pg .96, where it
appears to be throwing away the user I give the connect string. Some
debugging seemed to verify this. Could someone confirm my bug or let me
know how I'm misguided? :)
The crux of it seems to be this line:
$user = $ENV{DBI_USER} unless $user eq "";
Before this line, user is defined as 'mark', afterwards, it's
undefined. The intent of the line seems to be default to $ENV{DBI_USER}
if no user is provided. If that's the case, wouldn't be like this:
$user = $ENV{DBI_USER} if $user eq "";
The password gets the same kind of treatment.
More complete debugging output is below. Thanks!
(I'm using DBI v1.15)
-mark
http://mark.stosberg.com/
#############################################3333
DBD::Pg::dr::connect(/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/DBD/Pg.p
m:78):
78: my $Name = $dbname;
DB<3> x $drh
0
DBI::dr=HASH(0x853d8c0)
'Attribution' => 'PostgreSQL DBD by Edmund Mergl'
'Debug' => 0
'Err' => SCALAR(0x8335678)
-> undef
'Errstr' => SCALAR(0x83356a8)
-> undef
'Handlers' => ARRAY(0x853d80c)
empty array
'ImplementorClass' => 'DBD::Pg::dr'
'Name' => 'Pg'
'State' => SCALAR(0x81f6240)
-> undef
'Type' => 'dr'
'Version' => 0.96
DB<4> x $dbname
0
'dbname=cascade;host=localhost;'
DB<5> x $user
0
'mark'
DB<6> x $auth
0
''
DB<7> n
DBD::Pg::dr::connect(/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/DBD/Pg.p
m:79):
79: $Name =~ s/^.*dbname\s*=\s*//;
DB<7> n
DBD::Pg::dr::connect(/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/DBD/Pg.p
80: $Name =~ s/\s*;.*$//;
DB<7> n
DBD::Pg::dr::connect(/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/DBD/Pg.pm:82):
82: $user = "" unless defined($user);
DB<7> n
DBD::Pg::dr::connect(/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/DBD/Pg.pm:83):
83: $auth = "" unless defined($auth);
DB<7> n
DBD::Pg::dr::connect(/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/DBD/Pg.pm:85):
85: $user = $ENV{DBI_USER} unless $user eq "";
DB<7> n
DBD::Pg::dr::connect(/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/DBD/Pg.pm:86):
86: $auth = $ENV{DBI_PASS} unless $auth eq "";
DB<7> x $user
0 undef
DB<8> n
DBD::Pg::dr::connect(/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/DBD/Pg.pm:88):
88: my($dbh) = DBI::_new_dbh($drh, {
89: 'Name' => $Name,
90: 'User' => $user, 'CURRENT_USER' => $user,
DB<8> x $user
0 undef
DB<9> x $Name
0 'cascade'
DB<10>