How can you invoke interactive Perl debugging with hypnotoad or morbo?

我怕爱的太早我们不能终老 提交于 2019-11-30 19:16:14

morbo and hypnotoad are perl programs, so you can launch them with the -d switch.

perl -d $(which morbo) myMojoApp.pl

It's probably easiest to sprinkle a bunch of $DB::single = 1 statements around you app where you want your initial breakpoints to go and run c as the first debugger command. When you run a request that hits a breakpoint, you'll get a debugger prompt in the terminal that launched morbo.

hypnotoad will be trickier to use with the debugger because it quickly closes all the standard filehandles, calls fork several times, and becomes a daemon.

As JHThorsen points out, standard Mojolicious tests are actually ordinary Perl scripts, so you can debug your tests with:

perl -d t/mytest.t

The -Ilib adds the lib/ directory to the @INC include list so your modules will be loaded.

One catch is that many modules are not loaded until execution time, so if the debugger hassles you about symbols that aren't loaded yet, you'll probably want to set breakpoints after forcing a debug prompt with a carefully inserted

$DB::single = 1;

Thanks to 'pink_mist'. You can do:

perl -d myMojoApp.pl daemon -l http://*:29849

But application config is not applyied. I do not know why.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!