Re: Apache::DBI on panther

2003-11-20 Thread Chris Devers
Okay, let me try a reduced version of this problem.

I have a short script that does nothing but establish a connection to
MySQL via DBI/DBD::MySQL:

$ cat test.pl
#!/usr/bin/perl -wT

use DBI;

my $host = localhost;
my $db   = [];
my $user = [];
my $pass = [];
my $dsn  = DBI:mysql:host=$host;database=$db;
my $dbh = DBI-connect( $dsn, $user, $pass )
  or die Cannot connect to database: \n$DBI::errstr\n $!;

print qq[Content-type: text/plain

If you can read this then DBI connected.
];

This file is hard-linked to test.mpl. Apache is configured to serve .pl
files as normal CGI scripts, but will use Apache::Registry to serve .mpl
files.

Here's what happens when I request the corresponding url, first as a CGI:

$ lynx -dump http://devers.homeip.net:8080/test/test.pl
If you can read this then DBI connected.


No error there. Here's the mod_perl version:

$ lynx -dump http://devers.homeip.net:8080/test/test.mpl

Software error:

Cannot connect to database:
Protocol mismatch. Server Version = 0 Client Version = 10
  at /Library/WebServer/Documents/test/test.mpl line 10.

For help, please send mail to the webmaster
([EMAIL PROTECTED]), giving this error
message and the time and date of the error.

$


Again with the protocol mismatch.

According to the MySQL manual --

http://www.mysql.com/doc/en/Upgrading-from-3.20.html

-- the following advice should apply:

If you are not using the --old-protocol option to mysqld, old clients
will be unable to connect and will issue the following error message:

  ERROR: Protocol mismatch. Server Version = 10 Client Version = 9

The new Perl DBI/DBD interface also supports the old mysqlperl interface.
The only change you have to make if you use mysqlperl is to change the
arguments to the connect() function. The new arguments are:  host,
database, user, and password (note that the user and password
arguments have changed places). See section 11.5.2 The DBI Interface.

Which is close, but [a] that's not the client version I'm seeing reported
(not sure if that matters...), and [b] the connection syntax I'm using
seems to be the same as what they're requesting:

  My version:
my $dsn  = DBI:mysql:host=$host;database=$db;
my $dbh = DBI-connect( $dsn, $user, $pass )

  Their suggestions:
$dbh = DBI-connect(DBI:mysql:$database, $user, $password);
$dbh = DBI-connect(DBI:mysql:$database:$hostname,
$user, $password);
$dbh = DBI-connect(DBI:mysql:$database:$hostname:$port,
$user, $password);

Substantially the same, right? Okay maybe not identical, but even if I use
verbatim what they're describing here, the results I'm seeing are still
the same -- works as a CGI, fails through mod_perl. Weird.

Beyond that, the closest relevant advice I can find is stuff like this:

http://www.phpbuilder.com/mail/php3-list/199810/1957.php

This means that PHP was compiled with an old version of the MySQL
client library. Make sure you have the libmysqlclient.a library
which matches your installed server and rebuild PHP from scratch.

Okay, but [a] I'm not using PHP, and [b] it seems like I'm using current
versions of the relevant material -- Apache::DBI installed via CPAN, and
MySQL kept up to date with Fink.


Hmm, this Interchange post seems promising...

Actually, this is only a MySQL versioning problem and has nothing
to do with Interchange.

Try

perl -MCPAN -e 'force install Mysql'

to re-install DBD::mysql and see if that makes a difference.

http://icdevgroup.org/pipermail/interchange-users/2000-August/30.html


Which may work, but I still don't get why I'm getting the two different
results depending on how the script gets called...



-- 
Chris Devers


Re: Apache::DBI on panther

2003-11-20 Thread Chris Devers
On Thu, 20 Nov 2003, Chris Devers wrote:

 Try

 perl -MCPAN -e 'force install Mysql'

 to re-install DBD::mysql and see if that makes a difference.

 http://icdevgroup.org/pipermail/interchange-users/2000-August/30.html


 Which may work, but I still don't get why I'm getting the two different
 results depending on how the script gets called...


...it didn't work.

Didn't work either, I should say.


...any ideas?

Maybe I should re-subscribe to the mod_perl list...



-- 
Chris Devers


Re: $^E bug and perl 5.8.0

2003-11-20 Thread Tim Bunce
On Wed, Nov 19, 2003 at 11:49:14AM -0500, Dan Sugalski wrote:
 
 I think I'll take steps to make this less likely for Parrot, though I'm
 not sure there's truly any good way to get around it anywhere but in the
 actual application code.

This issue has come on p5p before (a few years ago) and the consensus,
as I recall, was that $! shouldn't be tied directy to errno but
should be set explicitly by the internals whenever a pp op
was about to report an error to the application code.

Tim.