Hello everyone...

I've recently gotten the bug to get ptkdb working with my mod_perl 
setup.  I've refered to the section on this in Stas' mod_perl guide
and that certainly got me places, but as it stands, things are mightly
flakey.

Here's what I've got going on...

==================================================================

  * With
        $ perl -MCPAN -e shell
    I issued the commands:
        > install Apache::DB
        > install Tk
        > install Devel::ptkdb

  * I replaced the line of DB.pm
        require 'Apache/perl5db.pl';
    with:
        require 'Devel/ptkdb.pm';

  * I added the following to my httpd.conf file:

# -------------------------------
<Perl>
    use Apache::DB ();
    Apache::DB->init;
</Perl>
# -------------------------------

    (I believe that this could equally well be put into a startup.perl file
     that is brought in via PerlRequire, yes?)

  * In addition, I put in this:

# --------------------------------
<Location /TestHandler.pm>

    PerlFixupHandler +Apache::DB

    SetHandler  perl-script
    PerlSendHeader On
    PerlHandler Apache::TestHandler
    Options +ExecCGI

</Location>
# --------------------------------

  * I gave "nobody" X authority on my X console.  Just to make sure it
    was done right, I hit it with:
         xhost +

  * Finally, as root I started up a standalone web server with:
         httpd -X

==================================================================

With all this in place, I've been running the following Perl as 
a test:

=== TestHandler.pm ================================================
package Apache::TestHandler;

use strict;
use Apache::Constants qw (:common);

sub handler {

    my $r = shift;

    my %in = $r->args;

    $r->content_type('text/html');
    $r->send_http_header;

    my $host = $r->get_remote_host;

    $r->print(<<EOT);
<html>

<head><title>Welcome!</title></head>

<body><pre>
Welcome, $host, to the middle of the film.

EOT
    ;

    foreach my $i ( $in{'start'} .. $in{'end'} ) {
        $r->print("We are now doing [$i] -- ain't it great?\n");
    }

    $r->print("</pre>\n</body>\n</html>\n");

    return OK;
}

1;
=== end of TestHandler.pm =========================================

I've been requesting this directly, with:

# ------------------------------------------------------------
[rdice@monad lib]$ telnet localhost http
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /TestHandler.pm?start=67&end=76 HTTP/1.1
Host: localhost

# ------------------------------------------------------------

Error Symptoms:
===============

I've had a number of different reactions to this.

As of Friday (the last time I tried getting this stuff working), 
I would get an Internal Server Error the first time I tried running
this after starting up a stand-alone http server.  After that, the
second (and subsequent) times, I'd get the ptkdb debugger, and all would
be happy.

Today, I get the ptkdb debugger the first time I access the script and
I can run the script and debugger fine, but then it hangs right at the end 
of the process, and might even segfault the server.

Things have gotten even weirder when I've tried this set-up with
an Apache::Registry script.

The first time I try running this on the server I've invoked with
httpd -X, nothing happens other than an internal server error. 
The _second_ time, however, ptkdb pops up... and drops me straight 
away into Apache::StatINC.  This is fair, as I've got StatINC set up
in my httpd.conf.  I can run around in StatINC for a while inside of
ptkdb, but before I leave it I hit some kind of error that leaves
me with a

[Fri Nov 26 15:05:35 1999] [error] Undefined subroutine
&Apache::Registry::handler called.

in my error_log.  ptkdb also hangs, and I have to kill the httpd in order
to get out.  Note that this error is significant, as (it seems to me)
it _should_ be calling &Apache::Registry::MANGLEDFILENAME::handler.

It would be great if other people out there have had successful experiences
with ptkdb and mod_perl (both Apache::Registry and regular-old Perl
modules like TestHandlers.pm above).

Cheers,
Richard

----------------------------------------------------------------------------
 Richard Dice * Personal 514 816 9568 * Fax 514 816 9569
 Open Source Evangelist, HBESoftware * http://www.hbesoftware.com
 ShadNet Creator * http://shadnet.shad.ca/ * [EMAIL PROTECTED]
 Occasional Writer, HotWired * http://www.hotwired.com/webmonkey/
     "squeeze the world 'til it's small enough to join us heel to toe"
         - jesus jones

Reply via email to