How to step over a line in the debugger?

S

Sysadmin

Hi everyone,

I just found myself needing to use the debugger to sort out a problem in one of
my administrative scripts, and I realized I needed a feature that seems obvious
enough for a debugger, but I can't find it mentioned in perldebug or the Camel.
Is it possible to step over an arbitrary line of code, without executing it?

Let's say I have a script with simple example code like this:
print "Line 1.\n";
print "Line 2.\n";
print "Line 3.\n";

What must I do to execute line 1 and 3, but not line 2, inside the debugger?

If I load the debugger and enter one s command to execute line 1, what do I
enter to skip the next line and go directly to the one following it?

I'm not a programmer by training, if this is obvious then please enlighten me.
:)
 
P

Peter Scott

Hi everyone,

I just found myself needing to use the debugger to sort out a problem in one of
my administrative scripts, and I realized I needed a feature that seems obvious
enough for a debugger, but I can't find it mentioned in perldebug or the Camel.
Is it possible to step over an arbitrary line of code, without executing it?

No. The debugger is not directing the execution of your program, it is
observing it. All you can do is vary the places it stops to report what's
happening.
Let's say I have a script with simple example code like this:
print "Line 1.\n";
print "Line 2.\n";
print "Line 3.\n";

What must I do to execute line 1 and 3, but not line 2, inside the debugger?

If line 2 contained a conditional, e.g.

print "Line 2.\n" if $foo;

you could set $foo to false in the debugger before reaching the line.
That's about it.
 
S

Sysadmin

No. The debugger is not directing the execution of your program,
it is observing it. All you can do is vary the places it stops
to report what's happening.
:(
If line 2 contained a conditional, e.g.
print "Line 2.\n" if $foo;
you could set $foo to false in the debugger before reaching
the line.
That's about it.

Amazing, even VB6 can do it, but not perl.
I never thought I'd be lacking a feature in the debugger.

Oh well, thanks for answering!

Huh, is that from 2002, how have I managed to miss that title for so long? :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top