Link to home
Start Free TrialLog in
Avatar of Tolgar
Tolgar

asked on

How to debug into sub functions in Perl?

Hi,
I have subfunction in my code and Perl debugger cannot go into it.

Here is what I do:

perl -d myFile
b linenumber
c
s

Open in new window



It stops at linenumber and when I say step into it it skips. n also does not work.

Here is the beginning of my sub function:

SOME CODE

my (%c, %d);
sub logFunc {
    my ($a, $b) = @_;
    my $S;
    my $file;

SOME OTHER CODE

} #myFunc

SOME MORE CODE

Open in new window



How can I debug this code?
Avatar of point_pleasant
point_pleasant
Flag of United States of America image

n runs until the next statement (the one immediately following this one in the current file) is about to execute. Note that if the current line is a subroutine call, the debugger won't stop until returning from that subroutine. To stop at the first line of the called subroutine, use the s (single-step) command instead. The r command executes until returning from the current subroutine (i.e., until we pop the activation stack).

Avatar of Tolgar
Tolgar

ASKER

Well, I already use s but it still does not go into the subroutine. Why is that?

Thanks,
ASKER CERTIFIED SOLUTION
Avatar of clockwatcher
clockwatcher

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial