Re: Having difficulties with Tie::DBI and mod_perl

2000-09-28 Thread Doug MacEachern

On Wed, 20 Sep 2000 [EMAIL PROTECTED] wrote:

> PerlFreshRestartOn

try turning that Off.  does DBI/DBD::mysql work for you without
Tie::DBI?




Please Help! Having difficulties with Tie::DBI and mod_perl

2000-09-21 Thread todd . bruner



I'm groveling...Please help.  I'm extremely frustrated with this, so
forgive the reposting.  I added the Carp module as suggested in the
"mod_perl guide: mod_perl and Relational Databases" web pages.  Now
in the Logs I have the following:

[Thu Sep 21 15:30:34 2000] [error] Before Tie
[Thu Sep 21 15:30:34 2000] Carp.pm: Had to create DBD::mysql::dr::imp_data_size
unexpectedly at /usr/local/perl/lib/site_perl/5.6.0/sun4-solaris/DBI.pm line
687.
[Thu Sep 21 15:30:34 2000] Carp.pm: Had to create DBD::mysql::db::imp_data_size
unexpectedly at /usr/local/perl/lib/site_perl/5.6.0/sun4-solaris/DBI.pm line
687.
[Thu Sep 21 15:30:34 2000] [error] [Thu Sep 21 15:30:34 2000] Carp.pm: Undefined
 subroutine &DBD::mysql::db::_login called at
/usr/local/perl/lib/site_perl/5.6.0/sun4-solaris/DBD/mysql.pm line 131.


Versions of software I'm using:
ApacheDBI-0.87
DBI-1.14
Tie-DBI-0.91
Apache_1.2.12
mod_perl-1.24

The tie example below works when executed on the command line:
#!/usr/local/perl/bin/perl
use Tie::DBI ();

$table = "Users";  $key   = "UserName";
$user  = "xx"; $pass  = "yyy";

tie my %DB, 'Tie::DBI', {
 'db' => 'mysql:ids',
 'table'   => $table,
 'key' => $key,
 'user'=> $user,
 'password' => $pass } or print "Error\n";

while (($key,$value) = each %DB) {
 print "Key = $key:\n";
 foreach (sort keys %$value) {
  print "\t$_ => $value->{$_}\n";
 }
}

ANY help would be greatly appreciated.  Feel free to
respond directly if you prefer.  Thanks in advance.
---------- Forwarded by Todd Bruner/USA/BAC on 09/21/2000 02:50 PM
---


Todd Bruner
09/20/2000 03:55 PM

To:   [EMAIL PROTECTED]
cc:
Subject:  Having difficulties with Tie::DBI and mod_perl

Please forgive what may be an often encountered problem, but
I haven't found anything helpful in the archive or other online sources.

I am encountering a problem that I can't figure out when trying to access
a Mysql database from with mod_perl using Tie::DBI.  I am having
similar problems when I use straight DBI as well.  I eventually wish
to use Apache::DBI for a persistent connection, but I can't get this
to work first.

Here's the particulars:

Problem: programs that try to access the database just stop, no error in
 in logs.  Logging statements or print statements after an attempted
  access to the db are never executed.

http.conf contains the following entry (otherwise everything is standard)
(Placed at beginning of httpd.conf if placement location matters)

# Load mod_perl specific stuff

Include conf/perl.conf


perl.conf contains the following:

PerlRequire conf/startup.pl
PerlFreshRestartOn


 SetHandler perl-script
 PerlHandlerApache::test


My startup.pl contains the following:

#!/usr/bin/perl

BEGIN {
 use Apache ();
 use lib Apache->server_root_relative('lib/perl');
}

# commonly used modules
use Apache::Constants ();
use CGI qw(-compile :all);
use CGI::Carp ();

##
1;

/lib/perl/Apache/test.pm contains:

package Apache::test;
use strict;
use CGI qw(:standard);
use Apache::Constants qw(:common);
use Tie::DBI;
sub handler {
my $r = shift;
 $r->log_error("Before Tie");
tie my %DB, 'Tie::DBI', {
'db'=> 'mysql:userdb',
'table' => 'Users',
'key'   => 'UserName',
'user'  => 'uuu',
'password'  => 'ppp',
} or return SERVER_ERROR;
 $r->log_error("After Tie");
print   header(),
start_html( -title  => 'Test' ,
-bgcolor=> 'white');
while ( my ($key,$value) = each %DB ) {
print "Key=$key \n";
foreach (sort keys %$value) {
print "\t$_ => $value->{$_}\n";
}
}
print   end_html();
}
1;
__END__

I start and stop apache with apachectl.  I then point my browser to

http://myserver/test

and nothing happens.  Browser pops up a dialog saying: "Document contains
no Data..." and the only entry is the "Before Tie" in the apache error log.
No errors in the mysql error log either.

What am I missing???

Thanks in advance for the help.

Todd






Having difficulties with Tie::DBI and mod_perl

2000-09-20 Thread todd . bruner



Please forgive what may be an often encountered problem, but
I haven't found anything helpful in the archive or other online sources.

I am encountering a problem that I can't figure out when trying to access
a Mysql database from with mod_perl using Tie::DBI.  I am having
similar problems when I use straight DBI as well.  I eventually wish
to use Apache::DBI for a persistent connection, but I can't get this
to work first.

Here's the particulars:

Problem: programs that try to access the database just stop, no error in
 in logs.  Logging statements or print statements after an attempted
  access to the db are never executed.

http.conf contains the following entry (otherwise everything is standard)
(Placed at beginning of httpd.conf if placement location matters)

# Load mod_perl specific stuff

Include conf/perl.conf


perl.conf contains the following:

PerlRequire conf/startup.pl
PerlFreshRestartOn


 SetHandler perl-script
 PerlHandlerApache::test


My startup.pl contains the following:

#!/usr/bin/perl

BEGIN {
 use Apache ();
 use lib Apache->server_root_relative('lib/perl');
}

# commonly used modules
use Apache::Constants ();
use CGI qw(-compile :all);
use CGI::Carp ();

##
1;

/lib/perl/Apache/test.pm contains:

package Apache::test;
use strict;
use CGI qw(:standard);
use Apache::Constants qw(:common);
use Tie::DBI;
sub handler {
my $r = shift;
 $r->log_error("Before Tie");
tie my %DB, 'Tie::DBI', {
'db'=> 'mysql:userdb',
'table' => 'Users',
'key'   => 'UserName',
'user'  => 'uuu',
'password'  => 'ppp',
} or return SERVER_ERROR;
 $r->log_error("After Tie");
print   header(),
start_html( -title  => 'Test' ,
-bgcolor=> 'white');
while ( my ($key,$value) = each %DB ) {
print "Key=$key \n";
foreach (sort keys %$value) {
print "\t$_ => $value->{$_}\n";
}
}
print   end_html();
}
1;
__END__

I start and stop apache with apachectl.  I then point my browser to

http://myserver/test

and nothing happens.  Browser pops up a dialog saying: "Document contains
no Data..." and the only entry is the "Before Tie" in the apache error log.
No errors in the mysql error log either.

What am I missing???

Thanks in advance for the help.

Todd