Re: Custom debugger subs and Apache::DB

2006-07-11 Thread Philip M. Gollucci
R Koch wrote:
 On 7/10/06, Philip M. Gollucci [EMAIL PROTECTED] wrote:
 Why not use Apache::DProf part of Apache::DB ?

 
 I did try that first, but I couldn't get it to work at all. I exactly
 followed the examples in the module's documentation, and apache runs
 with Apache:Dprof loaded; but I never got an output file to run
 through dprofpp.
I might get to looking at it soonish...
Load Apache::DProf as early as possible in your startup.pl file.
BEFORE other uses particularly the code you are interested in I forget that 
one all the time
and go crazy for about an hour each time.


-- 

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night.


Re: Custom debugger subs and Apache::DB

2006-07-11 Thread Perrin Harkins
On Mon, 2006-07-10 at 23:09 -0400, R Koch wrote:
 On 7/10/06, Philip M. Gollucci [EMAIL PROTECTED] wrote:
  Why not use Apache::DProf part of Apache::DB ?
 
 
 I did try that first, but I couldn't get it to work at all. I exactly
 followed the examples in the module's documentation, and apache runs
 with Apache:Dprof loaded; but I never got an output file to run
 through dprofpp.

Well, I have no experience with custom debugger subs, so I can't help
you with that, but Apache::DProf works, and if you want to get that
going you are welcome to post your config information here for help.

- Perrin



Custom debugger subs and Apache::DB

2006-07-10 Thread R Koch

Hi,
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 SubTrace.pm'
Perl
 use APR::Pool ();
 use Apache::DB ();
 Apache::DB-init();
/Perl

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 127.0.0.1
/Location

#and package SubTrace.pm 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::sub;
$DB::ret = undef;
   }elsif (wantarray) {
 @DB::ret = $DB::sub;
 @DB::ret;
   }else{
 $DB::ret = $DB::sub;
 $DB::ret;
   }
}
1;

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/perl5db.pl 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
.perldb?

Because the process blew up, I also tried not setting the
PerlFixupHandler to Apache::DB and instead wrapped my SubTrace.pm 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
enabled.

Thanks in advance for any tips or advice!
RK


Re: Custom debugger subs and Apache::DB

2006-07-10 Thread Philip M. Gollucci
R Koch wrote:
 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
Why not use Apache::DProf part of Apache::DB ?

-- 

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night.


Re: Custom debugger subs and Apache::DB

2006-07-10 Thread R Koch

On 7/10/06, Philip M. Gollucci [EMAIL PROTECTED] wrote:

Why not use Apache::DProf part of Apache::DB ?



I did try that first, but I couldn't get it to work at all. I exactly
followed the examples in the module's documentation, and apache runs
with Apache:Dprof loaded; but I never got an output file to run
through dprofpp.
I fiddled with it for a while and then gave up because making my own
DB::sub() and DB:DB() seemed easier. I'm not doing anything overly
fancy and those 2 subs are all I need.
And I also am more interested in rolling my own, to understand more
about using DB.pm in various ways.

Regards,
RK