in reply to Re: display source lines under debug after exec (updates 2)
in thread display source lines under debug after exec

I'm not trying to always run the script under the debugger. I want to step through the code and verify that my new Perl script is doing exactly what I want. Since it is going to be connecting to an external vendor to send files via SFTP I want to see is running correct. After The script has been debugged I will take out the -d to invoke the debugger and let it rip. I realize that I could setup my environment in a separate step but that would not be a true test of the entire script
  • Comment on Re^2: display source lines under debug after exec (updates 2)

Replies are listed 'Best First'.
Re^3: display source lines under debug after exec (updates 2)
by LanX (Saint) on May 01, 2018 at 16:05 UTC
    > I'm not trying to always run the script under the debugger

    That's the crucial point!

    A sane approach is to run the debugger manually only if needed and to avoid that hard coded switch.

    If you stick with this magic, you'll need to fix the line array by yourself.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Wikisyntax for the Monastery

      Unfortunately that's what I thought I will run the code as 2 different scripts until I'm sure that the code works then recombine them.
        This works for me, use the -d as first switch and use warnings explicitly.

        But I still don't recommend this approach.

        #!/usr/bin/perl -d use strict; use warnings; print "1"; print "2"; print "3";

        main::(./perl.sh:5): print "1"; DB<1> v 2: use strict; 3: use warnings; 4 5==> print "1"; 6: print "2"; 7: print "3"; DB<1> s main::(./perl.sh:6): print "2"; DB<1> 1v 3: use warnings; 4 5: print "1"; 6==> print "2"; 7: print "3";

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Wikisyntax for the Monastery