Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Interprocess / Skript to Skript (http://www.velocityreviews.com/forums/t895999-interprocess-skript-to-skript.html)

clqrq@yahoo.de 01-09-2006 03:10 AM

Interprocess / Skript to Skript
 
Hi there, i'm a little bit stuck with my programm and need help, so
let me reduce it to the problem...

I have two skripts; the first does the following:
It saves the Process-ID ($$) to a file and enters a loop, waiting for
Strings.

The second shall read the PID from file and till here, everything is
fine. Now, skript #2 shall send a string (lets say $test='Hallo';) to
Skript #1 and wait for reply. What I dont understand is:

How can Skript #2 send a string to Skript #1?
How can Skript #1 get the String.

- - -
#!/usr/bin/perl

#####################################
The First Skript
#####################################

if (open(BS,'>','../server.pid')) {
print BS $$;
close BS;
}

#
# here we need a loop, checking for incoming messages
# and processing strings, then returning them to sender
# - one special message shall break the loop
#

exit;

- - - -

#!/usr/bin/perl

#####################################
The Second Skript
#####################################

$test='hallo';

if (open(BS,'<','../server.pid')) {
$Server-PID=<BS>;
close BS;
}

print &CallServer($Server-PID,$test);

exit;

sub CallServer {
my $answer=''; # the answer of the server
my $SPID=$_[0]; # servers PID
my $Message=$_[1]; # Message to send

#
# here we need a way to send $$ and one or
# more strings to $Server-PID, waiting for response
#
return $answer;
}



All times are GMT. The time now is 03:54 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.