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 here. However when I run this 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 coun +t = `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_arr +ay()) { print "Field1: $count\n Field2: $phrase\n Field3: $aut +hor\n Field4: $submitted_ by\n\n"; } $dbh->disconnect();

I get this error
Global symbol "$DBI" requires explicit package name at ./dbitest.pl line 10.
Global symbol "$DBI" requires explicit package name at ./dbitest.pl line 12.
Execution of ./dbitest.pl aborted due to compilation errors.

If I comment out use strict <nbsp&><nbsp&><nbsp&>I get a different goofy error:

/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

What am i doing wrong or do I need to reinstall the module?


In reply to DBD::mysql barfs by scottstef

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.