in reply to Re^2: passing setup via pipeline
in thread passing setup via pipeline

I think you want open3 or similar.

open3(*TO_CHLD, *FR_CHLD, undef, 'bash')

Then you can print out commands to TO_CHLD and collect the output from FR_CHLD. Then you can issue shell commands including aliases, and the state of the shell (incl current work dir and environment settings) will persist between commands.

Hum, actually, you would need a pty instead of a pipe to get interactive behaviour. IPC::Run can do all of this pretty easily, so it's probably a better choice than open3

Replies are listed 'Best First'.
Re^4: passing setup via pipeline
by almut (Canon) on May 25, 2010 at 18:20 UTC
    ... Then you can print out commands to TO_CHLD and collect the output from FR_CHLD.

    I think one of the tricky things with open3 is how to correctly detect the end of multi-line responses, e.g. when issuing commands like ls -l (or the respective alias), as the pesistent shell won't close the pipe when done with the command.

      I don't think the OP needs to isolate responses. I take "I'm writing a Tk entry that emulates term" to mean he wants to build a console.