Here's an interesting little bug that's been driving me crazy and a quick fix to it.
It only appears when using Oracle's OS authentication on a script called with the -w
flag
#!/usr/local/bin/perl
use strict;
use warnings 'all';
use Carp();
use DBI;
# We are connecting using Oracle's OS Authentication
# See:
# http://www.geocities.com/SiliconValley/Heights/6616/ops.html
# http://www.bijoos.com/oratom/ot_199808.htm
my $dbh = DBI->connect( "dbi:Oracle:") || die($DBI::errstr);
my $sth = $dbh->prepare("select 'online' from dual");
$sth->execute();
my ($val) = $sth->fetchrow_array();
$sth->finish();
$dbh->disconnect;
run the script normally:
$> perl test_script.pl
$>
and nothing happens. BUT, run it with -w and behold:
$> perl test_script.pl
Use of uninitialized value in substitution (s///) at
/usr/local/lib/perl5/site_perl/5.6.1/sparc-solaris/DBD/Oracle.pm
line 209.
$>
Here's a diff that shows how to get rid of it:
$> diff /usr/local/lib/perl5/site_perl/5.6.1/sparc-solaris/DBD/Oracle.pm
lib/perl/site/DBD/Oracle.pm
208,209c208,209
< if (DBD::Oracle::ORA_OCI() >= 8) {
< $dbname = $1 if !$dbname && $user =~ s/\@(.*)//s;
---
> if (DBD::Oracle::ORA_OCI() && DBD::Oracle::ORA_OCI() >= 8) {
> $dbname = $1 if !$dbname && $user && $user =~ s/\@(.*)//s;
Much thanks for your work on this most wonderful framework!
=>Chris
--
Christopher R. Baker
Tune Smith / Programmer
http://cbaker.org