Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Simple (hopefully) shell/system() execution question

by Tomte (Priest)
on Apr 26, 2006 at 08:04 UTC ( #545720=note: print w/ replies, xml ) Need Help??


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


Comment on Re: Simple (hopefully) shell/system() execution question
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://545720]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2015-07-06 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls