Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

When I debug some_script.pl (thus: perl -d some_script.pl), I start out at the top and want to skip to the specific line /usr/lib/perl5/Somewhere/Deep/Within.pm:1234 where the interesting action is. How do I do that?

I tried the c command with that line, but that gives a syntax error from the debugger. I also tried without the colon, that does not work, either. The documentation is not helping because it does not explain what the syntax for the line argument is.

Replies are listed 'Best First'.
Re: debugger: continue to specific line
by apl (Monsignor) on May 02, 2008 at 09:46 UTC
    As per the debugger documentation, you'd say c 1234.

    If you showed us your exact command and the syntax error from the debugger, a better suggestion could be made.

      But you need to change the current file first, i.e. f /usr/lib/perl5/Somewhere/Deep/Within.pm
Re: debugger: continue to specific line
by zentara (Cardinal) on May 02, 2008 at 13:33 UTC
    I don't know if you are aware of the Perl/Tk frontend to the debugger Devel::ptkdb, but with that, all it takes is a mouse click to set a Breakpoint, then you push the Run button and it will proceed to the next break point. ptkdb Control Menu

    It might make life easier for you.


    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: debugger: continue to specific line
by Burak (Chaplain) on May 02, 2008 at 14:38 UTC
    Long way:

    run that file in the debugger and continue to the point where Somewhere::Deep::Within is loaded. Then, lets say, if that line 1234 is inside &Somewhere::Deep::Within::foo():

    c Somewhere::Deep::Within::foo c 1234
    The shortcut to that is to edit /usr/lib/perl5/Somewhere/Deep/Within.pm and add
    $DB::single = 2;
    before that line and then you can continue to that point automatically...