From Pickwiki
Jump to navigationJump to search


A perl client to take form fields and transfer them over to a server equipped to deal with them...

sunset /usr/local/apache/share/cgi-bin> cat 

use CGI qw(:standard);
use IO::Socket;


print header();

$server = IO::Socket::INET->new("sunset:1999") or die " $@\n";

if ($acc eq "") {
   print $client "<H1>Internal cgi error - must specify an account!</H1>\n";
   return 0;

print $server $acc,"\n";
foreach $key (param()) {
   # This join is a little obscure - if the field being returned is
   # single valued it does nothing.  only for select lists with multiple
   # items does it produce a dynamic array
   $value = join($fld_delim, param($key));
   # Likewise, this next line usually does nothing, except when a multi-line
   # text box is being retrieved.  it too produces a dynamic array
   $value =~ s/\r\n/$fld_delim/og;
   # Send the data thru the named pipe to CGI.MASTER
   print $server "$key=",$value,"\n";

print <$server>;
print end_html;