How to use debugger with mod_perl

I am trying to connect the Perl debugger to Apache and mod_perl. our environment is rather complicated (a lot of additional materials (for example, Catalyst) configured using Apache), and the engineers who set it up don't last longer with the company. I followed the instructions on the Apache website, installing "PerlFixupHandler Apache :: DB", etc. but so far all i get is a break in the debugger after the page has been delivered. I assume that I am getting a break in the sending process, not a workflow. I am running prefork MPM version of Apache. Debugging instructions pass the -X option when httpd starts. But the httpd that I run does not accept the -X option. I assume that the -X option will actually cause some versions of httpd to NOT evolve?

All guidelines are appreciated.

$ ./httpd -v Server version: Apache/2.2.17 (Unix) Server built: Nov 16 2010 20:13:24 -X isn't listed when I do httpd -? Usage: ./httpd [-D name] [-d directory] [-f file] [-C "directive"] [-c "directive"] [-k start|restart|graceful|graceful-stop|stop] [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] 
+7
source share
3 answers

In the book "Pro Perl Debugging" there is a chapter "Debugging a CGI program" and the unit "Configuring mod_perl".

Sorry, I do not have access to the book right now.

+1
source

I and several others in my company have been trying for several years to connect a debugger to mod_perl. We managed to break a few points in the mod_perl process before we actually reached the code in our ASP pages, but we never managed to get inside our ASP pages. Even if we burst before our code is launched, and then c into our $ DB :: single = 1 statement inside our interesting code, the page will start until completion and will not break (it seems to skip $ DB :: single )

We all believe that there is an error in our version of perl, our version of perl5db, or our version of mod_perl, which makes it impossible to do for our version. We are on perl 5.8.9, and some version of apache 2 that is eluding me at the moment.

I know this is not an answer, but I just wanted to tell you about it so that you don’t feel bad about giving up if you finally give up.

This problem that we encounter with mod_perl is one of the main reasons that I go into the process of adding a Plack layer between our web server and our application. With this level of abstraction, I can start another web server in development - and one in which I can connect a debugger. I don’t get involved with this in the same way as suggesting that you do it, but only because you know that I am really serious about interactive debugging.

I think the next logical step in the epic battle for interactive debugging in mod_perl would be to build the latest version and see if it works. Then update our version of perl and see if it works.

0
source

I successfully run the debugger that comes with the perl epic module for eclipse, as well as the komodo debugger.

For Komodo, you add something like the following to apache2.conf

 <IfDefine DEBUG> <Perl> use ModPerl::Registry; use lib qw(/usr/local/lib/perl/Komodo-PerlRemoteDebugging-6.0.3-59641-linux-x86); $ENV{PERLDB_OPTS} = "RemotePort=127.0.0.1:9000 LogFile=stderr"; $ENV{DBGP_IDEKEY} = "yourkey"; use Apache::DB (); Apache::DB->init; </Perl> </IfDefine> 

Follow the instructions here: http://docs.activestate.com/komodo/4.4/debugperl.html

For epic

 <IfDefine DEBUG> PerlModule ModPerl::Registry PerlSetEnv PERLDB_OPTS "RemotePort=192.168.xx:9500 DumpReused ReadLine=0 PrintRet=0" PerlSetEnv PERL5DB "BEGIN { $DB::CreateTTY=0; require /path_to_epic_db_scripts/perl5db.pl'; }" PerlRequire /path_to_epic_db_scripts/db.pl PerlPostConfigRequire /etc/apache2/perl/whatever.pl </IfDefine> 

See documentation here: http://www.epic-ide.org/guide/ch06.php

Of course, Epic is free, but Komodo is not, and this shows that it is still not bad. I have to say that about 18 months have passed since I called to use it, so as far as I remember. Good luck ....

0
source

All Articles