http://www.perlmonks.org?node_id=545720


in reply to Simple (hopefully) shell/system() execution question

Have a look at Expect, it is written for exactly the situation you describe: drive an interactive program out of a perl program.

A solution could look like (straight out of the pod):

# if you prefer the OO mindset: my $exp = new Expect; $exp->raw_pty(1); $exp->spawn("./unrar", "e", $file); or die "Cannot spawn $command: $!\n"; # send some string there: $exp->send("PASSWORD\n");

Edit: reworded "would something look" to "could look", added pod-reference.

regards,
tomte


An intellectual is someone whose mind watches itself.
-- Albert Camus