1

I'd like to do something in bash like:

 coproc myPerlDebuggerServer { perl -d -e 42; }

then talk to that co-process via shell functions to get my own interactive interface to the debugger.

Of course this doesn't work as is because perl -d -e 42 uses decorations/readlin/terminal/etc.

I found Devel::REPL but it had a build failure with cpanm, and anyway I'd like to keep the familiar commands from perl -d. I just need it to print a distinctive-enough prompt so when I know it's done responding :)

Suggestions?

Britton Kerin
  • 427
  • 4
  • 9

1 Answers1

2

Suggestions?

you can communicate to perl5db.pl via sockets, that's how the debugger integration is done in IDEs. Hence you can build any frontend you want.

See https://perldoc.perl.org/perl5db.pl#SOCKET-HANDLING

Also Devel::ptkdb (https://metacpan.org/pod/Devel::ptkdb) an example for a TkGUI interfacing to the debugger.

FWIW: Your question is quite fuzzy and I think it's a XY problem, but well you asked for this.

LanX
  • 478
  • 3
  • 10
  • Well I recently found ble.sh and I really like it. So naturally I'm wanting to get rid of readline in other places. I've had some success doing this for sqlite3 client for example with a sqlite3 -interactive then I just send commands to it as a coproc. But as usual the problem of lack of control of other program makes pipes tricky and perl -d doesn't seem to have a mode that works out as well as -interactive. – Britton Kerin Mar 25 '23 at 10:10
  • Btw I think the paragraph above the one you cite really nails the particular issue with using coproc/stdio to do it: "If there is a TTY hanging around from a parent, we use that as the console.". I haven't checked but closing the tty in the coproc before launching the debugger in the coproc seems promising (if somewhat a tricky manipulation). – Britton Kerin Mar 25 '23 at 10:14
  • I'm at lose what you are trying to achieve. I had a short look at at ble.sh, but there are many Perl REPLs which have syntax highlighting. If you wanna have a deep discussion about pro and cons, you might wanna start a thread at www.Perlmonks.org The interface is web1.0 but discussions run deep. HTH :) – LanX Mar 25 '23 at 15:03
  • if it's just about replacing `Term::Readline`, there is also `Term::ReadLine::Perl` which could be used as a base for experimenting. – LanX Mar 25 '23 at 15:06
  • Like here: https://github.com/akinomyoga/ble.sh/discussions/309 I sometimes end up typing/pasting somewhat long constructs into perl -d, though not as much so as sqlite3. ble.sh has gone through and added much better vim mode that what readline has so I like to use it instead. – Britton Kerin Mar 26 '23 at 22:35