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

I am new to mojolicious, but have been using Perl for some time. I have to jump over some hoops, but I can get the Perl (and Komodo) interactive debugger working with remote connections for Apache, but I can't find anything about interactive debugging using hypnotoad or morbo.

Examples from the command line in the basic tutorial http://mojolicio.us/perldoc/Mojolicious/Guides/Tutorial#Hello-World work fine, because you can run them with perl -d, but I don’t see anyway to tell a hypnotoadctl script to put the service in interactive debug mode ala apache.

Is it impossible? Tips? Tips? Pointers?

+8
perl mojolicious hypnotoad
source share
3 answers

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

 perl -d $(which morbo) myMojoApp.pl 

Probably the easiest way is to sprinkle a bunch of $DB::single = 1 statements around your application where you want your starting breakpoints to start c as the first debugger command. When you run a request that hits the breakpoint, you will receive a debugger prompt in the terminal that launched morbo .

hypnotoad will be more difficult to use with the debugger, since it quickly closes all standard file descriptors, calls fork several times, and becomes a daemon.

+7
source share

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

 perl -dt/mytest.t 

-Ilib adds the lib/ directory to the @INC inclusion list so that your modules load.

One of the tricks is that many modules do not load before runtime, so if the debugger bothers you with symbols that are not loaded, you probably want to set breakpoints after forcing debugging with carefully inserted

 $DB::single = 1; 
+2
source share

Thanks to pink_mist. You can do:

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

But the config application is not applied. I do not know why.

+1
source share

All Articles