If someone can write a section explaining how to do that properly, I think it'll be a great addition to our docs. Just post the pod here and I'll add it. Thanks.
OK, I'm not exactly a hand at writing pod but I had a go. Here it is:
=head1 NAME
perldbemacs - How do debug mod_perl using perldb in Emacs
=head1 DESCRIPTION
The perldb function in Emacs allows you to run the Perl debugger while viewing the source code in another window. It is a much nicer environment for debugging Perl than the plain standalone Perl debugger. This is how to use perldb to debug mod_perl code.
=head2 Modifying perl5db.pl
Unfortunately, this requires a modification to perl5db.pl. First you need to locate your copy of perl5db.pl. You can use perldoc to do it:
perl /usr/bin/perldoc -l Apache::perl5db.pl
or if you're using a specially built perl:
/my/perl `which perldoc` -l Apache::perl5db.pl
it will print out something like this:
/usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi/Apache/perl5db.pl
That's the file you need to edit. Locate the line:
$rl = 0, shift (@main::ARGV) if $slave_editor;
and right before it insert the line
$slave_editor ||= $ENV{SLAVE_EMACS};
=head2 Preparing httpd.conf
Now you need to make sure that the SLAVE_EMACS environment variable makes it to the perl code that runs inside Apache. Fortunately this is easy:
PerlPassEnv SLAVE_EMACS
=head2 Your debugging script
Prepare a script for debugging. Call it, say, C</home/myacct/httpd-debug>. It should go something like this:
#!/bin/sh SLAVE_EMACS=1 exec httpd -X -DPERLDB=1
That is, of course, assuming that your mod_perl httpd is on the C<PATH>
=head2 Starting the debugger
=over 4
=item 1.
Launch emacs.
=item 2.
Run the perldb function (Alt-X perldb)
=item 3.
It will prompt you by saying C<Run perldb (like this):>, with a default response after the colon. Instead of the default, type in C</home/myacct/httpd-debug dummy>, i.e. the script you prepared above. The C<dummy> is a dummy argument to keep emacs happy.
=item 4.
You should now be running the debugger.
=back
-- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html