> -----Original Message-----
> From: Ronald J Kimball [mailto:[EMAIL PROTECTED]
> Sent: 07 June 2004 14:34
> To: 'Dan Hopkins'; [EMAIL PROTECTED]
> Subject: RE: :Oracle::st ... Use of uninitialized value in subroutine
> entry
> 
> Dan Hopkins [mailto:[EMAIL PROTECTED] wrote:
> 
> 
> > I'm getting bizzare errors against previously working code (multiple
> > scripts). Basically, the
> > 
> >     while (.... = $sth->fetch*...)
> > 
> > loops all fail on the final iteration with:
> > 
> > "Use of uninitialized value in subroutine entry at 
> <myscript>.pl line
> > <whatever>
> > DBD::Oracle::st fetchrow_array warning:  [for Statement <mySQL>] at
> > <myscript.pl> line <whatever>"
> 
> > Any suggestions (or ridicule if I'm missing something 
> obvious) welcomed.
> 
> Well, the first suggestion would be to show us the actual code that is
> causing this warning!
> 
> Anyway, I've found that when "Use of uninitialized value in subroutine
> entry" occurs, it's usually due to calling a constant sub 
> with an ampersand
> and no parens.  Something with the duplication of @_ in this 
> case causes the
> warning.  To solve this, either remove the & or add empty 
> parens to the
> constant subroutine call.
> 
> Ronald

The example code was a bit brief ... my point was that really ANY fetch
loops seem to generate the error, whether they're user defined, or part of
the compound DBD methods, e.g.:


[EMAIL PROTECTED]: cat dbtest2.pl 
#!/usr/local/bin/perl -w
use strict;
use DBI;

my $dbh = DBI->connect('DBI:Oracle:testdb', 'user', 'pass', {RaiseError =>
0, PrintError => 0, AutoCommit => 0}) or die "connect: $DBI::errstr\n";
my $row = $dbh->selectcol_arrayref("SELECT sysdate FROM dual") or die
"selectcol: $DBI::errstr\n";
$dbh->disconnect;

[EMAIL PROTECTED]: ./dbtest2.pl 
Use of uninitialized value in subroutine entry at ./dbtest2.pl line 7.
DBD::Oracle::db selectcol_arrayref warning:  [for Statement "SELECT sysdate
FROM dual"] at ./dbtest2.pl line 6.
 

No ampersand notation, no user defined subs outside the DBI/DBD modules.
Just weirdness!

Thanks,
-- 
Dan

Reply via email to