Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Automating user input for a CLI-based program on windows

by chuckbutler (Priest)
on Jun 15, 2010 at 23:52 UTC ( #844946=note: print w/ replies, xml ) Need Help??


in reply to Automating user input for a CLI-based program on windows

From the OP, IPC::Run3::run3 does not seem to work, I have included a working example below. (ActivePerl 5.10.1, IPC::Run 0.043) This will run the program in batch mode, which may or not work, or be what you want in your case.

use strict; use warnings; use IPC::Run3; my (@fromme, @tome); ## Setup my input... push @fromme, "3*12\n"; push @fromme, "40*4\n"; ## Do it; running CLI calculator, but could be anything unless (run3( "bc.exe", \@fromme, \@tome, \@tome )) { ## STDIN STDOUT STDERR ...for the program print "ERROR in command\n"; } print "Return code = $?\n"; ## Return output while ($_ = shift @tome) { print "$_"; } __END__ ~~Output~~ Return code = 0 36 160

Maybe update your post with more detail of what you wish to do.

Good luck. -c


Comment on Re: Automating user input for a CLI-based program on windows
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2014-09-03 03:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (35 votes), past polls