while preparing a test case for the perl debugger of perl 5.11.3, i tried to use the '-d' switch in the shebang line of my testscript. I did that in order to make the script selfcontained.
perlrun suggests there is no difference in switches given in the commandline and the shebang line.
However when i started the script without the commandline switch '-d', the initialization for the debugger was incomplete. All line information seemed to be lacking.
Here is the script, which uses some debugger type ahead commands to make it self contained.
[Update: I exchanged the originally wrong script with the right one, sorry.]#!./perl -wd use strict; use warnings; BEGIN { push @DB::typeahead, 'b 8', 'L b', 'c', 'q'; $DB::single = 0; } print "Hello\n";
Here is a session without the -d commandline option. No line information is available. I checked this also interactively with the 'l' debugger command. There is no output. The %DB::dbline hash has not been set up.
Here is the same session with a -d commandline parameter:heiko@heiko-desktop:~/perl/my_tests$ ~/perl5.11.3 option_d_bug.pl Loading DB routines from perl5db.pl version 1.33 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(option_d_bug.pl:8): auto(-4) DB<1> b 8 Line 8 not breakable. auto(-3) DB<2> L b auto(-2) DB<3> c Hello 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. auto(-1) DB<3> q
From my point of view switch processing should be the same in both cases.heiko@heiko-desktop:~/perl/my_tests$ ~/perl5.11.3 -d option_d_bug.pl Loading DB routines from perl5db.pl version 1.33 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(option_d_bug.pl:8): print "Hello\n"; auto(-4) DB<1> b 8 auto(-3) DB<2> L b option_d_bug.pl: 8: print "Hello\n"; break if (1) auto(-2) DB<3> c Hello 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. auto(-1) DB<3> q heiko@heiko-desktop:~/perl/my_tests$
Ok, now for the question: Can some kind monk point me to the location in the Perl source, where shebang option processing is taking place? I try to find a fix then.
Thanks a lot, hexcoder
In reply to Should options in the shebang line generally behave like switches given in the commandline? by hexcoder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |