in reply to Re: How edit source code in perl debug mode
in thread How edit source code in perl debug mode

Well, I think you misunderstand me, I know how debug perl code and how set personal macro on IDE. My question is perl debugger is powerful but why many monks choose print for debug, after all,-d is a part of standard perl. To me, not using -d is because it can’t edit in place, it can’t let me make a real debug release.
  • Comment on Re^2: How edit source code in perl debug mode

Replies are listed 'Best First'.
Re^3: How edit source code in perl debug mode
by eyepopslikeamosquito (Archbishop) on May 05, 2024 at 10:01 UTC

    My question is perl debugger is powerful but why many monks choose print for debug

    As for why many famous programmers strive to minimize time spent in crack-pipe debugging sessions see : on Debuggers References

    👁️🍾👍🦟
      You'd be surprised how many people are introduced to learning Perl with an IDE doing a visual debugger run before the actual run.

      Once introduced they stick with this habit of having the current line highlighted in their code.

      My ex employer was more than unhappy that he couldn't run his web application inside the debugger, and I somehow never told him how to do this ;)

      I also think that the introduction of lexical variables changed a lot. Before that action at a distance with global variables created a need for debugger runs with watch expressions.

      Edit

      But as always, it's not black and white, there are legitimate cases for debugger use.

      This DON'T and NEVER rules often lead to dogmatic stupidity.

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

Re^3: How edit source code in perl debug mode
by haj (Vicar) on May 04, 2024 at 11:29 UTC
    To me, not using -d is because it can’t edit in place

    That's a really weird statement. A debugger and an editor are two different tools with different user interfaces. Many IDEs integrate them both.

    If debugging from the command line, you can fire up the editor of your choice with e.g. system "nano $0" and then edit in place. Integrating the user interface of any editing capabilities in the debugger looks like a bad idea for me.

      FWIW

      The debugger has a very open interface, allows to define aliases or new commands.

      The current filename and line number and code are also easily available.

      See perldebug and perldebguts

      It also supports piping to a "pager" app, which could be less, vi, nano or emacs, etc

      So anything the OP was hinting at could be quite easily implemented.

      I'm not doing to showcase it tho, because the motivation and requirements are more than fuzzy

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

Re^3: How edit source code in perl debug mode
by LanX (Saint) on May 04, 2024 at 11:26 UTC
    > many monks choose print for debug, after all,-d is a part of standard perl

    I think I'm one of the main debugger experts here, and I hardly ever use it for debugging.

    My own code is better debugged with tests and conditional warns.

    Mainly because it's easily reproduced while interactive debugger sessions aren't. I prefer sustainable investments.

    Occasionally I use debug or trace if I need to take over complex foreign code.

    But mostly because of bad design, testing or documentation.

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

Re^3: How edit source code in perl debug mode
by LanX (Saint) on May 04, 2024 at 11:05 UTC
    The debugger can't edit files, editors edit files.

    You need to combine² them if you want both.

    Running emacs in the console is IMHO the closest you can do to have that look and feel of the debugger editing files.¹

    Fletch's link to realgud has a screenshot , albeit for Python.

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

    ¹) well, IIRC, there is a command to spawn an (configurable) editor on the file debugged. Maybe that's what you want?

    ²) that's very much the meaning of IDE