in reply to No DBI->connect_cached?

Have you a use DBI; line in your code? Did you copy and paste the error message, or have you "cleaned it up" for us?


DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: No DBI->connect_cached?
by brent.allsop (Acolyte) on Sep 03, 2007 at 02:45 UTC
    Yes, I have the following in my startup.pl:
    use DBI; use DBD::mysql;
    And here is the exact error from the apache error log:
    [Sun Sep 02 20:40:30 2007] [error] [asp] [4441] [error] Can't locate o +bject method "connect_cached" via package "DBI" at /usr/local/webtool +s/func.pm line 75. <--> , /usr/lib/perl5/site_perl/5.8.8/Apache/ASP.p +m line 1521
    Here is the func.pm line 74 and 75 the asp script calls:
    my $dsn = 'DBI:mysql:database=canonizer_devel_3:host=localhost;port=33 +06'; my $dbh = DBI->connect_cached($dsn, $user, $password, { RaiseError => +1, AutoCommit => $autocommit });
      IIRC it is not enough to list the modules you use in startup.pl, you must still use them in your scripts itself. startup.pl just does some pre-loading only, so you save time when running your scripts.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      I wonder if there is a mismatch between the Apache::DBI version and the version DBI expects to see? From the DBI docs:

      However, if Apache::DBI is loaded then connect_cached will use it.

      DWIM is Perl's answer to Gödel