galande has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I want to start a shell as a child, from my perl script. I wanted to use facilities given by shell, like auto file name completion, at same to I want control over the input given to shell. How do I do this ..... Thanks.
  • Comment on How to control input of a child programme ...

Replies are listed 'Best First'.
Re (tilly) 1: How to control input of a child programme ...
by tilly (Archbishop) on Nov 18, 2000 at 15:32 UTC
    Use the Expect module.

    Warning: For most programming tasks there are alternate modules which are cleaner solutions. For example to list files you may want to use one of these.

Re: How to control input of a child programme ...
by AgentM (Curate) on Nov 18, 2000 at 11:54 UTC
    There is no way to control the input that a child receives (unless you specifically program or alter this spawned process). Since you'll need something other than the shell, emulating some sort of completion, Term::Complete is the way to go. Load the directory's contents into the requested array. You may also implement the allowed commands in a similar manner, snatching modules as you need them. Better yet, make a more user-friendly interface, perhaps with menus, perhaps graphical or Curses, to make it clear to the user exactly which options he has- limiting in a friendly manner!
    AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.