Mike Campbell wrote:
Ok here is what I get.

Test using DBD::SQLite (same output when used command-line and via webpage)
=====================
the SQLite v3 is 1.27

Test using DBD::SQLite2 (same output when used command-line and via webpage)
the SQLite v2 is 0.33
<snip>

At first glance you seem to be doing things adequately in your code samples.

However, your code looks very old-fashioned, maybe because you based it on old code you saw somewhere, and making it into more modern Perl can probably help.

For starters, when you are using DBI, *always* configure it to throw exceptions on errors rather than just return nothing.

Instead of this:

$db = DBI->connect("dbi:SQLite:dbname=/tmp/bugpush.db", "", "")
      || die( $DBI::errstr . "\n" );

... do this:

$db = DBI->connect("dbi:SQLite:dbname=/tmp/bugpush.db", "", "",
        { RaiseError => 1 });

That alone should go further towards you getting useful error messages when you should be.

Also you can remove all your tests like "if(! defined($sth) || ! ($sth))" or "if (! defined( $rc ) )".

When DBI is set to throw exceptions, you can just code as if each step will work and you don't need to test, since the program should die by itself if something goes wrong.

Instead, you just do tests when you want the program to not die but rather be more graceful when something goes wrong, and then you do it by setting up an exception handler (an "eval" block), but we don't need to get into that now.

So try making those changes and see what effect is has.

I'm not immediately in the position to run your code myself, not having mod_perl installed.

It would be helpful if you could provide more information on your setup.

What versions of Perl and DBI are you using, to start with.

To find out, you can use code like this:

  my $perlvers = $[;

  use DBI;
  my $dbivers = $DBI::VERSION;

Run that on both command-line and mod-perl as usual.

Also your versions of Apache and mod_perl are useful to know.

Also try running your code under FastCGI, or CGI, rather than mod_perl and see if that has any effect on the result. Include the tests for what DBD::SQLite/etc version is running if necessary.

Maybe someone else on this list has ideas?

-- Darren Duncan


_______________________________________________
DBD-SQLite mailing list
DBD-SQLite@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbd-sqlite

Reply via email to