U. *_*ndl 0 debugging perl breakpoints constant-expression
我有Perl代码,它使用带有初始化块的常量,如下所示:
use constant C => map {
...;
} (0..255);
Run Code Online (Sandbox Code Playgroud)
当我尝试在该行上设置断点时...;,它不起作用,这意味着:我可以设置断点,但是调试器不会在此停下来。
我试过了:
perl -d program.pl)启动程序b 2)中设置断点R,然后运行(r)程序但是调试器仍然没有停止,就像我没有设置断点一样。
我的Perl不是最新的;它是5.18.2,以防万一。
您试图将一个断点放在一个use块中。use块实际上是BEGIN其中包含a的块require。默认情况下,Perl调试器不会在编译阶段停止。然而可以强制Perl调试成单步模式一个内部BEGIN由可变设定块$DB::single到1
见Debugging Compile-Time Statements在perldoc perldebug
如果您将代码更改为
use constant C => map {
$DB::single = 1;
...;
} (0..255);
Run Code Online (Sandbox Code Playgroud)
Perl调试器将在use语句中停止。