5

Please bear with me, because I don't really know the first thing about Dancer2, other than the fact that I've inherited something written with it.

I want to attach a regular debugger to it, and it's valiantly resisting most of my attempts.

Say I have:

package Wharrgarbl;
use Dancer2;

# lots of stuff

get '/wharrgarbl/:potato' => sub {
  use DB; $DB::single = 1;
  # probably too much code here
}

And I want to be able to attach a debugger to that response handler. How do I complete this incantation?

perl -d -I wharrgarbl/lib -MWharrgarbl -E 'Wharrgarbl->???("/wharrgarbl/fnorb")'
simbabque
  • 53,749
  • 8
  • 73
  • 136
badp
  • 11,409
  • 3
  • 61
  • 89
  • My current approximation is `Wharrgarbl->apps->[0]->dispatch({})`, which wants a `path_info` as a string, but adding `path_info => '/wharrgarbl/fnorb'` isn't helping. – badp May 26 '17 at 15:34
  • [Related question about Mojolicious](https://stackoverflow.com/questions/32013380/how-can-you-invoke-interactive-perl-debugging-with-hypnotoad-or-morbo) – mob May 26 '17 at 15:38

1 Answers1

0

I imagine your Dancer2 app is being started via plackup, e.g. plackup -p 5000 bin/app.psgi (probably more arguments). plackup is just a perl script, so you could try perl -d `which plackup` -p 5000 bin/app.psgi

Sam Kington
  • 1,202
  • 11
  • 14