问题
I've recently started work on a project that uses mod_perl. I'm attempting to use the Perl debugger to debug some Perl scripts that are running under mod_perl. I start the debugger with the following command:
sudo OPTIONS="-X -DPERLDB" /etc/init.d/httpd restart
The relevant debugging section of perl.conf (included by httpd.conf) is:
<IfDefine PERLDB>
<Perl>
use Apache::DB ();
Apache::DB->init;
</Perl>
<Location />
PerlFixupHandler Apache::DB
</Location>
</IfDefine>
That takes me into the debugger. When I load the required page in the browser, the debugger breaks on the first line of the Perl script that has been wrapped by mod_perl (the app is using PerlRun, btw). I can now step through the code, print variables, and so on.
My problem is that the commands to view source code (l
, -
and v
), don't display anything when inside a Perl script. They work as expected inside a module - that is, if the code steps into a module that is used by the Perl script, the view source commands work.
Is this a known problem with debugging in mod_perl? Is there anything I can do to fix it?
I'm using Apache 2.2.3 and Perl 5.8.8 on CentOS 5.6 x86_64.
回答1:
I've ran into the problem before, and have an educated guess about the problem. My current working theory is that the debugger doesn't show the code that perl parsed, because perl already threw it away during the compile phase. Instead, the debugger looks through relative paths to get the source code from the actual file. However, the debugger starts looking from the Apache server root, which may not be the same as where you started Apache. When it can't find the file, it shows up as a bunch of blank lines.
来源:https://stackoverflow.com/questions/7584931/mod-perl-debugging-viewing-source