Home > Archive > PERL CGI Beginners > October 2005 > running interactively
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
running interactively
|
|
| Adriano Allora 2005-10-12, 7:55 am |
| ha to all,
I need to use a a shell-program but I cannot pass all the arguments to
this program via system() function. In other words: the program doesn't
accept all the arguments via command line: I need to open it and write
interactively some instructions.
Is there a module which works in this way?
How can I do?
Thank you all,
alladr
|^|_|^|_|^| |^|_|^|_|^|
| | | |
| | | |
| |*\_/*\_/*\_/*\_/*\_/* | |
| |
| |
| |
| http://www.e-allora.net |
| |
| |
**************************************
| |
| Chris Devers 2005-10-12, 7:55 am |
| On Wed, 12 Oct 2005, Adriano Allora wrote:
> I need to use a a shell-program but I cannot pass all the arguments to
> this program via system() function. In other words: the program
> doesn't accept all the arguments via command line: I need to open it
> and write interactively some instructions.
>
> Is there a module which works in this way?
Yes: Expect.pm
> How can I do?
Read the documentation, then write a program that uses Expect.pm.
--
Chris Devers
| |
| Bob Showalter 2005-10-12, 7:55 am |
| Adriano Allora wrote:
> ha to all,
Ha back!
>
> I need to use a a shell-program but I cannot pass all the arguments to
> this program via system() function. In other words: the program
> doesn't accept all the arguments via command line: I need to open it
> and write interactively some instructions.
If you just need to feed input via stdin, you can to a pipe open:
open F, "|/path/to/some_program" or die $!;
print F "command\n";
...
close F or die $!;
If the program expects to work with a terminal (tty), you can use the Expect
module to set up a pseudo-tty (pty) and interact with the program that way.
| |
| Paul Lalli 2005-10-12, 7:55 am |
| Adriano Allora wrote:
> I need to use a a shell-program but I cannot pass all the arguments to
> this program via system() function. In other words: the program doesn't
> accept all the arguments via command line: I need to open it and write
> interactively some instructions.
>
> Is there a module which works in this way?
Have a look at the Expect module on CPAN:
http://search.cpan.org/~rgiersig/Expect-1.15/Expect.pod
Paul Lalli
|
|
|
|
|