Fast CGI

Υλοποίηση στον εξυπηρετητή

Προβλήματα

Παράδειγμα

#!/usr/bin/perl

#load the necessary modules
use Pg;
use CGI qw/:standard/;
use CGI::Fast;

#connect to the database
$conn = Pg::connectdb("dbname=comments host=193.250.160.3\
                             user=george password=george");
die $conn->errorMessage unless PGRES_CONNECTION_OK eq $conn->status;

#Create a new FastCGI object
#This is the main program loop
while(new CGI::Fast){
   $name=param("name");
   $email=param("email");
   $comments=param("comments");

   #insert the record to the database
   $query="insert into comments values('".$name."','".$email.\
                                                "','".$comments."')";
   $result=$conn->exec($query);
   die $conn->errorMessage unless PGRES_COMMAND_OK eq $result->resultStatus;
   print "All done OK";
}
#close the connection
$conn->requestCancel