title: How do I handle and send POST requests in Perl and FastCGI?
body: <p>Unfortunately, I'm not familiar with Perl, so asking here. Actually I'm using FCGI with Perl.</p>
  
  <p>I need to 1. accept a POST request -> 2. send it via POST to another url -> 3. get results -> 4. return results to the first POST request (4 steps).</p>
  
  <p>To accept a POST request (step 1) I use the following code (found it somewhere in the Internet):</p>
  
  <pre><code>$ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/;
  if ($ENV{'REQUEST_METHOD'} eq "POST") {
      read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
  }
  else {
      print ("some error");
  }
  
  @pairs = split(/&amp;/, $buffer);
  foreach $pair (@pairs) {
      ($name, $value) = split(/=/, $pair);
      $value =~ tr/+/ /;
      $value =~ s/%(..)/pack("C", hex($1))/eg;
      $FORM{$name} = $value;  
  }
  </code></pre>
  
  <p>The content of <code>$name</code> (it's a string) is the result of the first step. Now I need to send <code>$name</code> via POST request to some_url (step 2) which returns me another result (step 3), which I have to return as a result to the very first POST request (step 4).</p>
  
  <p>Any help with this would be greatly appreciated.</p>
  
  <p>Thank you.</p>