CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Piping for IPC


New User

Feb 17, 2011, 7:05 AM

Post #1 of 1 (368 views)
Piping for IPC Can't Post

Perl Guru's:

I've got two scripts that I've written and I'd like to just send some simple messages from one to the other. I figured the easiest way to do this would be to just open a pipe from one script to the other so in the parent script I'm doing:

open(my $CAN_PIPE, "| perl "); 
print($CAN_PIPE, " DCAN21\n");
print($CAN_PIPE, " run \n");
print($CAN_PIPE, " q \n");

and in I try to read in data using a while(<>):

$/ = "\n"; 

print $_."\n";

#case statement to deal with input...

The child script ( works great if I call it by itself from the command line; it does everything I tell it and seems to read from STDIN just fine. However, when I call runCAN from the parent script it appears that the child is indeed excuted (debug print statements outside the while(<>) are executed) but the while(<>) which actually interprets the commands from teh STDIN pipe never runs.

I apologize in advance if this is n00b question. I searched around and couldn't find the answer. I spend most of my time doing embedded C for micros, so you'll have to forgive me.

Thanks in advance for the help,
Trey German
Texas Instruments


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives