Google Answers Logo
View Question
 
Q: Perl interprocess communication ( No Answer,   2 Comments )
Question  
Subject: Perl interprocess communication
Category: Computers > Programming
Asked by: programmerguy-ga
List Price: $5.00
Posted: 10 Dec 2005 15:30 PST
Expires: 13 Dec 2005 20:01 PST
Question ID: 604212
I am looking for a way to use a Perl programming language program to
act as an invisible "in-between" for interacting with command line
programs in win32 environments.

Output of the program should be identical to running the command line
program. The perl program should also be able to detect when the
command line program needs input and request it from the user.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Perl interprocess communication
From: bozo99-ga on 10 Dec 2005 17:11 PST
 
Have you read the "perlipc" man page ?

Bidirectional Communication with Another Process
While this works reasonably well for unidirectional communication,
what about bidirectional communication?  The obvious thing you'd like
to do doesn't actually work:
       open(PROG_FOR_READING_AND_WRITING, "? some program ?")
and if you forget to use the "use warnings" pragma or the -w flag,
then you'll miss out entirely on the diagnostic message:
           Can't do bidirectional pipe at -e line 1.
If you really want to, you can use the standard open2() library
function to catch both ends.  There's also an open3() for
tridirectional
I/O so you can also catch your child's STDERR, but doing so would then
require an awkward select() loop and wouldn't allow you to use
normal Perl input operations.

If you look at its source, you'll see that open2() uses low-level
primitives like Unix pipe() and exec() calls to create all the connec?
tions.  While it might have been slightly more efficient by using
socketpair(), it would have then been even less portable than it
already is.  The open2() and open3() functions are  unlikely to work
anywhere except on a Unix system or some other one purporting to be
POSIX compliant.
Subject: Re: Perl interprocess communication
From: programmerguy-ga on 13 Dec 2005 20:01 PST
 
yes, i did look at that. however, it does not have any way to use it
to be able to tell when it is possible to enter text into the other
program, so it prooves to be an almost-dead end. Good to see someone
looking where i was tho!

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy