Is there any work to get the Perl debugger to set breakpoints on modules that are not yet loaded?

So in the future, breakpoints will affect as soon as the target file loads. Otherwise, the debugger is unlikely to help ...

main::(test.pl:7): Class->new->go; DB<1> f Movie.pm No file matching `Movie.pm' is loaded. DB<2> b Movie.pm:10 Subroutine main::Movie not found. 

I know Movie.pm will be loaded and will want to install bp on its 10th line ...

+4
source share
3 answers

Workaround: require module when starting the debugger. You can put stuff in a .perldb rc file , so you do not need to type / paste it into every debugger session.

+4
source

I am having problems like this by manually entering the string "use" in the debugger.

  DB<1> b LWP::Simple::get Subroutine LWP::Simple::get not found. DB<2> use LWP::Simple DB<3> b LWP::Simple::get DB<4> 

Does it help?

+3
source

According to DOC

After each necessary file has been compiled, but before its execution, DB :: postponed (* {"_ <\ $ filename"}) is called if the DB :: subroutine is deferred. Here $ filename is the extended name of the required file found in% INC values.

Thus, you can connect this event and set breakpoints as soon as your module loads.

You can also try Devel :: DebugHooks . Feel free to ask me at irc.perl.org #debughooks if you have any questions.

+1
source

All Articles