http://qs321.pair.com?node_id=11111191

LanX has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I'm very used to tweak the perl-debugger for my needs to get a shell experience.

Under Win it's not that easy anymore because of the lack of CTRL shortcuts.

I can get used to the fact that CMD translates CTRL-a to select-all instead of beginning-of-line ...

... but CTRL-r for reverse searching the history is a life saver!

DB<1> (reverse-i-search)`':

Now I tried calling the debugger under Git-Bash, which has a decent xterm emulation under bash. Unless when I call perl -de0 this is lost.

I also tried to install Term::ReadLine::Perl and Term::ReadLine::Zoid and did set %PERL_RL% accordingly.

I also tried installing Devel::REPL (incl. dependencies) and Reply but no luck with reverse search.

My best bet ATM is to run the debugger under emacs.

so ... what do you use and does it work the same under Win and Linux?

My requirements:

Nice-to-Have This seems to be all available for Linux, but poorly tested resp. hard to achieve under Win.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

°) !!dir in the debugger returns escape codes which "destroy" the terminal

Replies are listed 'Best First'.
Re: Best Perl REPL/Shell on Win (and Linux)?
by Discipulus (Canon) on Jan 08, 2020 at 18:11 UTC
    WSL?

    clink (programmable in lua)?

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: Best Perl REPL/Shell on Win (and Linux)?
by shmem (Chancellor) on Jan 09, 2020 at 18:58 UTC

    I use a (heavily hacked) version of perlsh from the Term::ReadLine::Gnu distribution. It uses the same readline library as bash on Linux does. Alas, it is not available on vanilla Windows. But both MinGW and Cygwin provide that libraries, which are only useful if the terminal makes use of it, which the cmd window doesn't. Didn't try with powershell yet. But Cygwin sports a bash window, and with carefully setting up $PATH and PERL5LIB it could be possible to install Term::ReadLine::Gnu into e.g. strawberry perl, which I did not try yet, either. So, much handwaving here.

    But if I were to implement a good REPL, I'd definitely start with the GNU readline library.

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
Re: Best Perl REPL/Shell on Win (and Linux)?
by tobyink (Canon) on Jan 09, 2020 at 17:03 UTC

    I use Reply and is has pretty much everything on your requirements and nice-to-have lists, but no idea how well it performs on Windows. Have you tried Term::Readline::Gnu to get history, tab-completion, etc working? I don't know how well it works on Windows, but it's very good on Linux.

      > Have you tried Term::Readline::Gnu ...

      That's not that easy

      (Please correct me someone if I get the terminology wrong.)

      The standard console window on Windows is cmd.exe while it's a term(inal) on Linux.

      They have very different terminal emulations that includes escape sequences to navigate and write the console.

      Term::ReadLine::Gnu and Term::ReadKey are XS module for such *nix consoles.

      Now Git-Bash seems to be such a terminal, but comes with it's own bundled Perl and installing new modules there doesn't seem to be a good idea and fails anyway.

      Though it might be possible to run a different Perl installation there using Term::ReadLine::Perl (a non XS backend)

      But the cleanest solution would be a Term::ReadLine backend which translates to CMD consoles.

      > to get history, tab-completion, etc working?

      most of it actually works, it's only the key-binding which is not triggering.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Re: Best Perl REPL/Shell on Win (and Linux)? (emacs hack)
by LanX (Saint) on Jan 19, 2020 at 20:20 UTC

    > My best bet ATM is to run the debugger under emacs.

    FWIW: working directly under cmd.exe is still a PITA

    This will speed-start (-Q) emacs as a console app (-nw) inside your cmd.exe and activate the debugger

    %emacs% -nw -Q --eval "(perldb \"perl -d -e 0\")"

    %emacs% be a variable pointing to your emacs.exe

    like set emacs=C:\nonBKU\emacs_i386\emacs-24.3\bin\emacs.exe

    Everything works then.°

    C-x C-c to leave it again

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

    °) feel free to ask about config options.