Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Prompting for input inside IDE run (was Reading from STDIN)

by LanX (Saint)
on Mar 27, 2023 at 12:45 UTC ( [id://11151253]=note: print w/replies, xml ) Need Help??


in reply to Re: Prompting for input inside IDE run (was Reading from STDIN)
in thread Prompting for input inside IDE run (was Reading from STDIN)

> How do you run those programs inside emacs? I guess this is on Windows?

With mode-compile, which is not core, but nevertheless the default in cperl-mode.

You may want to look into the perl menu in the top-bar after activating cperl-mode.

<menu-bar> <Perl> <Run> runs the command mode-compile, which is an interactive autoloaded compiled Lisp function in `mode-compile.el'.

Auto flush was helpful yes, but input is still ignored.

Actually all input is considered compilation or error navigation commands, which makes sense in a buffer with start

Now I'm thinking about making my script automatically redirecting stdout and stdin to a spawned console /or buffer. This while still keeping stder in the compilation buffer...

I did this before in order to debug Term::ReadLine apps, have to dig that out again. I'm weak on tty Channel foo ...

Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^3: Prompting for input inside IDE run (was Reading from STDIN)
by haj (Vicar) on Mar 27, 2023 at 14:52 UTC
    With mode-compile, which is no not core but the default in cperl-mode.

    That would have been helpful to know. That entry is disabled in my Emacs because I don't have mode-compile. Heck, that thing is pretty stale and can't be byte-compiled nor M-x eval-buffered in Emacs 27...

    Anyway, mode-compile is the culprit. Contrary to its name, it runs the program, using a mechanism which does not make STDIN of the Perl process available to you.

    What you could do is wrap the following lisp snippet into a command which suits you:

    (compile "perl your_script.pl" t)

    Replacing the program name perl and script name your_script.pl by variables is left as an exercise to the reader. The t parameter does the trick to give you what Emacs calls a "comint" environment. So, you end up in a buffer *compilation* in compilation-mode with "clickable" error messages, but the buffer is not read-only, you can just enter text after the prompt.

      > (compile "perl your_script.pl" t)

      Yes, thanks, I already figured this out in the meantime.

      > variables is left as an exercise to the reader.

      That's one of the things mode-compile does for me (and is expected from an IDE nowadays)

      I will try to find a way to patch/configure mode-compile accordingly.

      Cheers Rolf
      (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
      Wikisyntax for the Monastery

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11151253]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-25 19:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found