Salvete omnes!

I'm trying to connect to a MySQL database. The connection works in a Perl script I run on the command line, but it fails in an HTML::Mason page executed by mod_perl.

I'm on Mac OS X 10.5.6, Perl 5.8.8, mod_perl 2.0.4, MySQL 5.0.45, DBI 1.607, DBD::mysql 4.010. Here's the code:

use DBI; my $dbsrc = 'DBI:mysql:test:localhost'; my %attr = ( PrintError => 0, RaiseError => 0 ); my $dbh = DBI->connect($dbsrc, 'mboudreau', 'secret', \%attr) or die " +$DBI::err str"; $dbh->disconnect;

and here's the error message I get:

Can't locate auto/DBI/connect.al in @INC (@INC contains: /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6/darwin-thread-multi-2level /Library/Perl/5.8.6 /Library/Perl/5.8.1 . /usr) at /Users/mrb/Sites/mason_mysql_test.mhtml line 17

I've searched my computer (sudo find / -name connect.al -print) for 'connect.al' and it's nowhere to be found. I've reinstalled DBI and DBD::mysql, no errors, no luck. Googling for this error message turns up a lot of people who had typos in their connection statement, but I don't think that's the case here (identical code works fine in a command-line script). Any guidance?


In reply to DBI error under mod_perl by mboudreau

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.