arunhorne has asked for the wisdom of the Perl Monks concerning the following question:
Monks
I am working on writing a Perl wrapper around the command line control utilities of a server. It is a log in "shell" essentially, so you start it with some basic information such as host and port and it provides you with a prompt, as so:
> {0}:
What I need to do now is send command in to this prompt sequentially, and potentially conditionally depending on logic in my wrapper. E.g. if I want to send the commands "start" and then "exit", thus if I typed it the prompt would look as follows:
> {0}: start
> {1}: exit
Is there any way in Perl I can achieve this, i.e. mimick manual input on stdin. If there is a way that uses only very core perl modules/core functionality that would be preferable as we only have a relatively basic installation of Perl and I cannot install new modules, but any help would be greatly appreciated.
Kind regards,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Interacting With A Program Over Stdin/Exec
by borisz (Canon) on Jun 23, 2004 at 10:04 UTC | |
|
Re: Interacting With A Program Over Stdin/Exec
by thospel (Hermit) on Jun 23, 2004 at 10:42 UTC | |
|
Re: Interacting With A Program Over Stdin/Exec
by zentara (Cardinal) on Jun 23, 2004 at 12:49 UTC |