jkeenan1 has asked for the wisdom of the Perl Monks concerning the following question:
I am surprised by certain behavior of the perl debugger. Let's say I have this very simple program in directory ~/learn/perl/p5p:
I run it from my home directory:$ cat abc.pl print "hello world\n"; print "goodbye world\n";
I get the expected results. I now run it thru the perl debugger from my home directory:$ cd $ perl ~/learn/perl/p5p/abc.pl hello world goodbye world
I get the expected results. Now I switch to the directory in which the progam is located and try to run the debugger on the program in that directory:$ perl -d ~/learn/perl/p5p/abc.pl Loading DB routines from perl5db.pl version 1.49_04 Editor support available. Enter h or 'h h' for help, or 'man perldebug' for more help. main::(/home/jkeenan/learn/perl/p5p/abc.pl:1): 1: print "hello world\n"; DB<1> c hello world goodbye world Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB<1> q
The debugger fails to stop at the first line of code, runs the entire program, then prints "Var=\n". If I switch to a directory underneath that directory and run the program through the debugger, I get normal results:$ cd learn/perl/p5p $ perl -d abc.pl hello world goodbye world Var=
I have no setting in PERLDB_OPTS that could explain this:$ cd xyz $ perl -d ../abc.pl Loading DB routines from perl5db.pl version 1.49_04 Editor support available. Enter h or 'h h' for help, or 'man perldebug' for more help. main::(../abc.pl:1): print "hello world\n"; DB<1> c hello world goodbye world Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB<1> q
Why is the debugger behaving this way when run on a program in the current directory?$ echo $PERLDB_OPTS
Thank you very much.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl -d: puzzling behavior when run in program in current directory (.perldb file)
by LanX (Saint) on Jan 01, 2017 at 16:37 UTC | |
|
Re: perl -d: puzzling behavior when run in program in current directory
by Linicks (Scribe) on Jan 01, 2017 at 15:51 UTC | |
by jkeenan1 (Deacon) on Jan 01, 2017 at 16:20 UTC | |
by jkeenan1 (Deacon) on Jan 01, 2017 at 16:49 UTC | |
by Anonymous Monk on Jan 01, 2017 at 16:49 UTC | |
by jkeenan1 (Deacon) on Jan 01, 2017 at 16:04 UTC | |
by Linicks (Scribe) on Jan 01, 2017 at 16:24 UTC |