in reply to Global symbol "$DBI" requires explicit package name

Kinda doubt it
use strict;
use diagnostics;
print "$DBI->errstr";
print "$DBI->errstr";
__END__
Global symbol "$DBI" requires explicit package name at - line 3.
Execution of - aborted due to compilation errors (#1)
    (F) You've said "use strict" or "use strict vars", which indicates
    that all variables must either be lexically scoped (using "my" or "state"),
    declared beforehand using "our", or explicitly qualified to say
    which package the global variable is in (using "::").

  • Comment on Re: Global symbol "$DBI" requires explicit package name

Replies are listed 'Best First'.
Re^2: Global symbol "$DBI" requires explicit package name
by NateTut (Deacon) on Dec 07, 2010 at 18:58 UTC
    I swear on my mother's grave (well she's not dead yet, but you get the picture) that I have been using this code for years without a problem. Did something change in DBI?

      This has nothing to do with DBI. You were using a variable you didn't declare ($DBI), and you asked to make such things errors by using (use strict;).

      While $DBI::errstr is also a variable you didn't declare, use strict; forgives qualified ("::") package variables.

      Although it's not documented, DBI->errstr might work. Maybe that's what you were using.

        You missed the update where he says he figured it out