Some programs writen in Perl using DBI+DBD+Mysql crashed when try to connect to database Reproducible: Always Steps to Reproduce: When the script it's run a error it's received : Can't use an undefined value as a HASH reference at /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/DBD/mysql.pm line 113. The database it's not open and the run stops. I've try to re-emerge perl, DBI, DBD, but the behavior it's the same. The last solution was to downgrade to a older version (DBD-Mysql-2.1027), and the scripts are running OK. Portage 2.0.51.19 (default-linux/x86/2005.0, gcc-3.3.5-20050130, glibc-2.3.4.20041102-r1, 2.6.11-gentoo-r6 i686) ================================================================= System uname: 2.6.11-gentoo-r6 i686 Pentium III (Coppermine) Gentoo Base System version 1.4.16 Python: dev-lang/python-2.3.5 [2.3.5 (#1, May 3 2005, 09:15:26)] dev-lang/python: 2.3.5 sys-apps/sandbox: [Not Present] sys-devel/autoconf: 2.59-r6, 2.13 sys-devel/automake: 1.7.9-r1, 1.8.5-r3, 1.5, 1.4_p6, 1.6.3, 1.9.5 sys-devel/binutils: 2.15.92.0.2-r7 sys-devel/libtool: 1.5.16 virtual/os-headers: 2.6.8.1-r2 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-O2 -march=pentium3 -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/bind /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -march=pentium3 -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms strict" GENTOO_MIRRORS="ftp://ftp.roedu.net/pub/mirrors/gentoo.org/ http://ftp.roedu.net/pub/mirrors/gentoo.org/ ftp://ftp.lug.ro/gentoo/" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://192.168.2.252/gentoo-portage" USE="x86 alsa apache2 berkdb crypt emboss encode extensions gdbm gif imlib jpeg libg++ libwww mad mikmod mp3 mpeg mysql ncurses nls pam pdflib perl php png python quicktime readline sandbox sdl slang snmp spell ssl svga tcpd tiff truetype truetype-fonts type1-fonts xml2 xv zlib userland_GNU kernel_linux elibc_glibc" Unset: ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY
Can we see some sample code? The newer DBD::mysql is far less forgiving than the older versions when it comes to your code.
use DBI; $drh = DBI->install_driver( "mysql" ); die "cannot load MySql driver:$!\n" if( !defined $drh ); $dbh = $drh->connect( "database", "user", "password" ); die "cannot connect to MySql database: $DBI::errstr\n" if( !defined $dbh );
This example is mixing connection methods for dbd::mysql. The hash it is looking for is because the first element of the connect should be the dsn line (perldoc DBD::mysql for a good example). I went through all of the example connection methods in the pod and all of them worked without a hitch. The error is in your code. My tests were with DBD-mysql-2.9006.
I've made the changes and everything it's OK. Thanks