perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "R Koch" <>
Subject Custom debugger subs and Apache::DB
Date Mon, 10 Jul 2006 09:00:33 GMT
I'm having some trouble working with Apache::DB. I would like to
override the debugger subs DB::DB and DB::sub with my own custom
versions. I tried several tips found on here and clpm, but can't quite
get it to work.
I'm running Perl 5.8.8, mod_perl 2, apache 2.0.55, Freebsd 5.5.

Here's what I'm doing:
# From httpd.conf. Note I've compiled perl so that @INC contains a lib directory
# in my /home where my modules are, and perl and httpd are able to use/require
# those modules.

PerlSetEnv PERL5DB 'require ""'
  use APR::Pool ();
  use Apache::DB ();

<Location ~ "/MyProject/.*cgi$">
  Options Indexes FollowSymLinks ExecCGI
  AllowOverride All
  SetHandler perl-script
  PerlResponseHandler ModPerl::Registry
  PerlOptions +ParseHeaders
  PerlFixupHandler +Apache::DB
  Order allow,deny
  Allow from

#and package contains:
package SubTrace;
sub DB::DB {}
sub DB::sub {
    if ($DB::sub =~ /^MyModule/ and $DB::sub !~ /DESTROY|CODE/) {
      warn "DB::sub: $DB::sub", $/;

    if ( $DB::sub eq 'DESTROY'
         or substr($DB::sub, -9) eq '::DESTROY'
         or not defined wantarray)
         $DB::ret = undef;
    }elsif (wantarray) {
      @DB::ret = &$DB::sub;
      $DB::ret = &$DB::sub;

Now for some reason this just blows up when I run 'httpd -X', the
httpd process becomes several hundred megs and the cgi never displays
anything. To make matters worse, I can't just ^C out, because the
debugger has taken over and spits out info that I don't want, so I
have to kill httpd.

I've looked through Apache::DB, and it should be eval'ing what I've
placed in PERL5DB
but instead it goes ahead and loads Apache/ which I don't
want. I don't want an interactive debugger, instead I want to generate
profiling logs based on my custom DB::DB and DB::sub routines. Maybe
there is a setting I overlooked to disable the interactive debugger
and its output in .perldb and maybe I can get Apache::DB to load

Because the process blew up, I also tried not setting the
PerlFixupHandler to Apache::DB and instead wrapped my code
in a BEGIN block, and also added $^P |= 1 to turn on the debugger at
compile time.
This seems to work, because I see output in the log file generated by
my DB::sub routine, however, my DB::DB routine does not seem to be
called at all, which was puzzling, so I think debugging is maybe not

Thanks in advance for any tips or advice!

View raw message