perlquestion
scottstef
I had some problems installing DBD::mysql, however it stated it installed clean. I am using the code from the tutorial [stephen] wrote on mysql located <a href="http://perlmonks.com/index.pl?node=Reading%20from%20a%20database&lastnode_id=954">here</a>. However when I run this code:
<p><code>
#!/usr/bin/perl -w
use strict;
use DBI;
my $dbh = DBI->connect('DBI:mysql:quotes', 'scott', 'some_password')
or die "dumbass it didn't work: '$DBI::errstr'; stopped";
my $sth = $dbh->prepare(<<END_SQL) or die "Couldn't prepare statement: $DBI:errstr; stopped";
SELECT count, phrase, author, submitted_by FROM qod WHERE count = `1`
END_SQL #This is Line 10
$sth->execute() or die "Couldn't make query: '$DBI:errstr'; stopped";
while ( my ($count, $phrase, $author, $submitted_by) = $sth->fetch_array())
{
print "Field1: $count\n Field2: $phrase\n Field3: $author\n Field4: $submitted_
by\n\n";
}
$dbh->disconnect();</code><p>
I get this error<br>
<i>Global symbol "$DBI" requires explicit package name at ./dbitest.pl line 10.<br>
Global symbol "$DBI" requires explicit package name at ./dbitest.pl line 12.<br>
Execution of ./dbitest.pl aborted due to compilation errors.<p></i>
If I comment out <i>use strict</i> <nbsp&><nbsp&><nbsp&>I get a different goofy error:<p>
<i>/usr/libexec/ld.so: Undefined symbol "_mysql_init" called from perl:/usr/local/libdata/perl5/site_perl/i386-openbsd/auto/DBD/mysql/mysql.so at 0x401bc284</i><p>
What am i doing wrong or do I need to reinstall the module?