Dear monks,

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.

#!./perl -wd use strict; use warnings; BEGIN { push @DB::typeahead, 'b 8', 'L b', 'c', 'q'; $DB::single = 0; } print "Hello\n";
[Update: I exchanged the originally wrong script with the right one, sorry.]

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.

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
Here is the same session with a -d commandline parameter:
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$
From my point of view switch processing should be the same in both cases.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.