Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > script to run the program

Reply
Thread Tools

script to run the program

 
 
a
Guest
Posts: n/a
 
      09-21-2005
I need to run a program that need input at run time.
Is it possible to simulate this by perl?
Thanx


 
Reply With Quote
 
 
 
 
Josef Moellers
Guest
Posts: n/a
 
      09-21-2005
a wrote:
> I need to run a program that need input at run time.
> Is it possible to simulate this by perl?
> Thanx
>
>


It depends.
You can open a pipe to the program and send the input through the pipe
(beware of buffering):
open(DST, '|', $program);
print DST "Input\n";

Or look at Perl/Expect.
--
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett

 
Reply With Quote
 
 
 
 
Joe Smith
Guest
Posts: n/a
 
      09-26-2005
Josef Moellers wrote:
> a wrote:
>
>> I need to run a program that need input at run time.
>> Is it possible to simulate this by perl?

>
> It depends.
> You can open a pipe to the program and send the input through the pipe
> (beware of buffering):
> open(DST, '|', $program);
> print DST "Input\n";
>
> Or look at Perl/Expect.


For interactive use (where a line of input depends on something that
was output previously), a PTY-based solution (such as Expect.pm)
is the way to go.
http://search.cpan.org/author/DJERIU...0.02/Simple.pm

-Joe
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Program will not run, used to run, have reinstalled numerous times,no luck Boppy NZ Computing 15 01-24-2011 10:30 AM
Run a python script as an exe and run a new process from it venutaurus539@gmail.com Python 9 02-27-2009 05:22 PM
Run ant script from ant script? lionelv@gmail.com Java 6 07-26-2007 02:12 AM
run a script and supply commands from a python cgi script moishyyehuda@gmail.com Python 1 12-14-2006 05:16 PM
how do i run another script from my python script nephish@xit.net Python 5 10-28-2005 02:06 AM



Advertisments