Re: Howto use emacs and perldb to debug mod_perl?

2004-05-08 Thread pdupreez-modperl
This works for me. Thanks!

I have some suggestions for the pod:

 =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 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,
just add the following to your httpd.conf:

 PerlPassEnv SLAVE_EMACS
 Perl
   use Apache::DB ();
   Apache::DB-init;
 /Perl
 PerlFixupHandler Apache::DB


  SLAVE_EMACS=1 exec httpd -X -DPERLDB=1
This can also be:
  SLAVE_EMACS=1 exec httpd -X -DPERLDB
(it's a matter of taste)


 =item 3.
 
 It will prompt you by saying CRun 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 Cdummy is a dummy argument to keep emacs happy.

=item 3.

It will prompt you by saying CRun 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.
Cdummy is required by emacs, as part of the name of the debug
window.
ie. For or Cdummy, the debug window will be called C*gud-dummy*.

cu
--
Pieter

-- 
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



Re: Howto use emacs and perldb to debug mod_perl?

2004-05-08 Thread pdupreez
This works for me. Thanks!

I have some suggestions for the pod:

 =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 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,
just add the following to your httpd.conf:

 PerlPassEnv SLAVE_EMACS
 Perl
   use Apache::DB ();
   Apache::DB-init;
 /Perl
 PerlFixupHandler Apache::DB


  SLAVE_EMACS=1 exec httpd -X -DPERLDB=1
This can also be:
  SLAVE_EMACS=1 exec httpd -X -DPERLDB
(it's a matter of taste)


 =item 3.
 
 It will prompt you by saying CRun 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 Cdummy is a dummy argument to keep emacs happy.

=item 3.

It will prompt you by saying CRun 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.
Cdummy is required by emacs, as part of the name of the debug
window.
ie. For or Cdummy, the debug window will be called C*gud-dummy*.

cu
--
Pieter

-- 
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



Re: Howto use emacs and perldb to debug mod_perl?

2004-05-08 Thread pdupreez-modperl
This works for me. Thanks!

I have some suggestions for the pod:

 =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 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,
just add the following to your httpd.conf:

 PerlPassEnv SLAVE_EMACS
 Perl
   use Apache::DB ();
   Apache::DB-init;
 /Perl
 PerlFixupHandler Apache::DB


  SLAVE_EMACS=1 exec httpd -X -DPERLDB=1
This can also be:
  SLAVE_EMACS=1 exec httpd -X -DPERLDB
(it's a matter of taste)


 =item 3.
 
 It will prompt you by saying CRun 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 Cdummy is a dummy argument to keep emacs happy.

=item 3.

It will prompt you by saying CRun 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.
Cdummy is required by emacs, as part of the name of the debug
window.
ie. For or Cdummy, the debug window will be called C*gud-dummy*.

cu
--
Pieter

-- 
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



Re: Howto use emacs and perldb to debug mod_perl?

2004-05-07 Thread Paul G. Weiss
On Thu, 06 May 2004 12:22:49 -0700, Stas Bekman [EMAIL PROTECTED] 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

=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 CPATH

=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 CRun 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 Cdummy 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


Re: Howto use emacs and perldb to debug mod_perl?

2004-05-06 Thread Paul G. Weiss
On Thu, 6 May 2004 16:12:16 +, [EMAIL PROTECTED] wrote:
James Moore claimed to have gotten it right:
http://groups.google.ch/groups?q=emacs+mod_perlhl=enlr=lang_en|lang_deie=UTF-8oe=UTF-8selm=1051404465.5094
+85%40yasurernum=1
It partially works for me. The last part doesn't:
James Moore wrote:
Not elegant, but it does get you full functionality (or at least the  
only
bit I cared about, the = pointer into your code buffer for the current  
line
of execution).

His method ruins it if you want to run the debugger w/o emacs.
Here's a modification that gets around that problem:
in the Apache/perl5db.pl file add the line:
$slave_editor ||= $ENV{SLAVE_EMACS};
right after the assignment to $slave_editor.
Then in your httpd.conf add the line:
PerlPassEnv SLAVE_EMACS
And in the script you pass to emacs when it says Run perldb (like this):
SLAVE_EMACS=1 exec httpd -X -DPERLDB
--
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


Re: Howto use emacs and perldb to debug mod_perl?

2004-05-06 Thread Stas Bekman
Paul G. Weiss wrote:
On Thu, 6 May 2004 16:12:16 +, [EMAIL PROTECTED] wrote:
James Moore claimed to have gotten it right:
http://groups.google.ch/groups?q=emacs+mod_perlhl=enlr=lang_en|lang_deie=UTF-8oe=UTF-8selm=1051404465.5094 

+85%40yasurernum=1
It partially works for me. The last part doesn't:
James Moore wrote:
Not elegant, but it does get you full functionality (or at least the  
only
bit I cared about, the = pointer into your code buffer for the 
current  line
of execution).

His method ruins it if you want to run the debugger w/o emacs.
Here's a modification that gets around that problem:
in the Apache/perl5db.pl file add the line:
$slave_editor ||= $ENV{SLAVE_EMACS};
right after the assignment to $slave_editor.
Then in your httpd.conf add the line:
PerlPassEnv SLAVE_EMACS
And in the script you pass to emacs when it says Run perldb (like this):
SLAVE_EMACS=1 exec httpd -X -DPERLDB
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.

--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
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


Re: Howto use emacs and perldb to debug mod_perl?

2004-05-05 Thread Frank Wiles
On Wed, 5 May 2004 20:40:08 +
[EMAIL PROTECTED] wrote:

 Hi,
 
 Has anyone succeeded in using the perldb debugger
 within emacs in order to debug apps that use
 mod_perl?
 
 The following works:
   /usr/sbin/apache-perl -X -D PERLDB
 but then I get the command line debugger.
 
 I know that ptkdb and ddd are other (GUI) options,
 but I would like to use emacs.
 
 Thanks in advance

  Not being an Emacs user, no I haven't tried that.  Doesn't Emacs
  just use the running perl debugger and redisplay it's output? 
  Does it do it by pid?  Do you get some kind of error message from 
  Emacs? 

  I've always just used it in the shell I launched the Apache process
  from. If you get me some more info about the problem you're seeing
  I'll play around with Emacs and see if I can get it to work for you. 

 -
   Frank Wiles [EMAIL PROTECTED]
   http://frank.wiles.org
 -


-- 
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