Apparently Autoloader is doing
require undef; if there is an
undef value in
@INC when
DBI's
connect method is called.
This code generates the warning if the line push @INC,$ENV{'PERL5LIB'}; is executed before the call to DBI->connect. It's not clear what the push @INC,$ENV{'PERL5LIB'}; is actually meant to be doing (this code has been copied from a system that was built several years ago).
The code connects to an Oracle database. Obviously it will not work with someone else's Oracle DB. If you do not have an Oracle database I do not know if the same issue shows up with other DBD drivers. I did see the same Autoloader warning appearing when I ran the code with invalid connect parameters, but don't know what was being complained about.
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics -warntrace; # the -warntrace does not seem to help B-(
use DBI;
sub db_connect;
my $Odbh; # database handle returned by connect to Oracle
print "$0: ",(scalar localtime), "\n";
#exit; #no warn if exit before db_connect call
&db_connect;
exit; # yes warn if exit after connect
print "$0: " ,(scalar localtime), " run complete\n";
$Odbh->disconnect;
#exit; # yes warn if exit after connect + disconnect
################
sub db_connect {
################
my ($dsn, $dbuser, $dbpassword) = ("DBI:Oracle:qq3","nn2","nn2");
#
# Connect to Oracle
#
# if the push on the next line is commented out there is no warning.
push @INC,$ENV{'PERL5LIB'}; # location of libs for DBD::Oracle
print "ENV= [",join ("]\n[",@INC),"]\n";
$Odbh = DBI->connect($dsn, $dbuser, $dbpassword,
{ RaiseError => 1, AutoCommit => 1 })
or warn "Can't connect to $dsn: $DBI::errstr";
}
This signature will be ready by Christmas