I have two CGI scripts written in Perl and I want to implement the following communication sequence between the two. Script A sends a POST request to script B, it should then wait for B to perform some type of validation by querying a Database, then B sends success or failure back to A along with a custom code e.g. 1122 specific to my application and A continues execution as appropriate. Is this something that can be achieved using the LWP framework ?
I have tried to send a POST request from A to B and then wait in script A using
while(<STDIN>) {
$response .= $_;
}
until it receives an answer back from B (another POST) but this does not work as A simply ignores the SDTIN loop and continues anyway.
Needless to say I am completely new to to CGI and most answers I have found involve a simple POST or GET request to a CGI script but not a two way communication where one end has to wait for the other to respond after a validation has taken place.