perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul G. Weiss" <>
Subject Re: Howto use emacs and perldb to debug mod_perl?
Date Fri, 07 May 2004 21:38:04 GMT
On Thu, 06 May 2004 12:22:49 -0700, Stas Bekman <> wrote:

> 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


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

Unfortunately, this requires a modification to  First you need
to locate your copy of  You can use perldoc to do it:

      perl /usr/bin/perldoc -l

or if you're using a specially built perl:

      /my/perl `which perldoc`  -l

it will print out something like this:


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:

      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.


Report problems:
Mail list info:
List etiquette:

View raw message