For Programmers: Free Programming Magazines  


Home > Archive > PERL Programming > July 2007 > Two consoles, each with their own distinct process









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Two consoles, each with their own distinct process
venet

2007-07-08, 6:59 pm

I am faced with a program that is written in Perl from which I am required
to grab a value at the end of the script's run. And, with nobody wanting to
modify that script, it is likely that any program reaching out and grabbing
that value will be a separate process; it will be another separate
standalone Perl script.

First question: does this arrangement fall under the category of (what I
recently discovered) is something called Inter-process Communication (IPC)?

Second question: If yes, or something like it, can somebody show me a sample
combination that consists of (A) a simple Perl script that is run on one
console, returns three distinct variables' values (let's say "Hello,
world!," "The sky is blue.," and "The grass is green."), and (B) an
entirely separate console--that has an entirely different Perl script--that
is designed to reach way over to the other runtime, and pick off only the
value correlating with the string "The sky is blue."?

Any help would be very much appreciated. Thank you.


Gunnar Hjalmarsson

2007-07-08, 6:59 pm

venet wrote:
> I am faced with a program that is written in Perl from which I am required
> to grab a value at the end of the script's run. And, with nobody wanting to
> modify that script, it is likely that any program reaching out and grabbing
> that value will be a separate process; it will be another separate
> standalone Perl script.
>
> First question: does this arrangement fall under the category of (what I
> recently discovered) is something called Inter-process Communication (IPC)?
>
> Second question: If yes, or something like it, can somebody show me a sample
> combination that consists of (A) a simple Perl script that is run on one
> console, returns three distinct variables' values (let's say "Hello,
> world!," "The sky is blue.," and "The grass is green."), and (B) an
> entirely separate console--that has an entirely different Perl script--that
> is designed to reach way over to the other runtime, and pick off only the
> value correlating with the string "The sky is blue."?


C:\home>type test2.pl
#!/usr/bin/perl
print <<EOC;
Hello, world!
The sky is blue.
The grass is green.
EOC

C:\home>type test.pl
#!/usr/bin/perl
@values = qx(test2.pl);
print grep /blue/, @values;

C:\home>test.pl
The sky is blue.

C:\home>

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com