in reply to Re: passing values to another perl program
in thread passing values to another perl program

Hi, I have a scenario, which I’m working on.. Perl script 1 abc.pl--- will have two parameters, $paramter1 $paramter2 It will call another perl script 2—xyz.pl, passing the two parameters, The perl script2, will be a tcp client requesting for a service with a java server. Once the service is done, I need to return a success/error code of 0 or 1 to th main perl script abc.pl Could u please explain how to do it.. I’m a newbie.. (abc.pl) #!/usr/local/bin/perl # # composite series of images over a background image # print "\nThis is from abc.pl"; $path = "/usr/bin"; $hostName ="127.0.0.1"; $cmd = "perl xyz..pl $hostName $path"; system($cmd)== 0 or die "system $cmd failed: " ,$? >> 8; if ($? == -1) { print "\n failed to execute: $!\n"; } elsif ($? & 127) { printf "\n child died with signal %d, %s coredump\n", ($? & 127), ($? & 128) ? 'with' : 'without'; } else { printf "\nchild exited with value %d\n", $? >> 8 ; } And I need to write xyz.pl I’m able to get param from abc.pl, But how to send back the error/ success code #!/usr/local/bin/perl # # composite series of images over a background image # use IO::Socket::INET; print "\n This is in xyz.pl"; if ($#ARGV != 1) { print "usage: e2.pl hostname , pathofResults \n"; exit(2); } $hostName = $ARGV[0]; $path = $ARGV1; #is this possible??? $msg = $hostName+$path ; # Create a new socket $MySocket=new IO::Socket::INET->new(PeerPort=>5000,Proto=>'tcp',PeerAddr=>’127.0.0.1’); # Send messages to server $MySocket->send($msg); $MySocket->recv($text,1024); print "\nReceived message : ", $text,"\n"; exit (2);
  • Comment on Re^2: passing values to another perl program