mod_perl调试&查看源 [英] mod_perl debugging & viewing source

查看:158
本文介绍了mod_perl调试&查看源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我开始使用一个使用mod_perl的项目。我试图使用Perl调试器来调试在mod_perl下运行的一些Perl脚本。我使用以下命令启动调试器:

  sudo OPTIONS = -  X -DPERLDB/etc/init.d/httpd重新启动

perl.conf的相关调试部分(由httpd.conf包含)是:

 < IfDefine PERLDB> 
< Perl>
使用Apache :: DB();
Apache :: DB-> init;
< / Perl>
<位置/>
PerlFixupHandler Apache :: DB
< / Location>
< / IfDefine>

这需要我进入调试器。当我在浏览器中加载所需的页面时,调试器将打破Perl脚本的第一行,该脚本已被mod_perl打包(应用程序正在使用PerlRun,btw)。我现在可以通过代码,打印变量等等。



我的问题是查看源代码的命令( l - v ),在Perl脚本内部不显示任何内容。它们按照预期的方式在模块中工作 - 也就是说,如果代码进入Perl脚本使用的模块,则视图源代码命令可以正常工作。



这是一个在mod_perl中调试的已知问题?我有什么可以解决的吗?



我在CentOS 5.6 x86_64上使用Apache 2.2.3和Perl 5.8.8。

解决方案

我以前遇到过这个问题,并且有一个有经验的猜测。我目前的工作理论是调试器不显示perl解析的代码,因为perl已经在编译阶段抛出了它。相反,调试器查看相对路径以从实际文件中获取源代码。但是,调试器从Apache服务器根开始查找,可能与启动Apache的位置不同。当它找不到文件时,它显示为一串空白行。


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.

解决方案

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.

这篇关于mod_perl调试&amp;查看源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆