azool has asked for the wisdom of the Perl Monks concerning the following question:

this code:
my $dbh = DBI->connect("dbi:mysql:table","user","password", {AutoCommit => 1, RaiseError => 1}) or die die "Can\'t connect: ",$DBI::errstr;
returns:
"Can't locate object method "connect" via package "DBI" at script.pl line 3."
DBI and DBD:mysql are installed and up-to-date... I'm at a loss as to what the problem is.

Replies are listed 'Best First'.
Re: Can't locate object method...
by elbie (Curate) on Apr 18, 2002 at 19:32 UTC
    Make sure you include the DBI module. Put

    use DBI;

    at the top of your script

    elbieelbieelbie

      That was it...
      I _knew_ it was something silly like that when I couldn't
      find anyone else who'd had the problem. I just knew it
      couldn't be OS X's fault ;)
Re: Can't locate object method...
by particle (Vicar) on Apr 18, 2002 at 19:21 UTC
    s/->/::/;

    Update: now don't i feel silly... look below.

    ~Particle ;Þ

      As the first line of DBI::connect() is my $class = shift;, what do you expect your code to do?