#!/usr/bin/perl # # faceClient # CGI interface between local voiceServer and Java face # applets/applications. # Requires # URI::Escape # IPC::Shareable # CGI::Request use IPC::Shareable; use CGI::Request; # Debugging stuff $IPC::Shareable::Debug = 1; # Simple interface: (combines SendHeaders, new and import_names) my $req = GetRequest($pkg); # Full Interface: # We only need to output info, so this isn't required. $req = new CGI::Request; # fetch and parse request my $faceglue = 'facedata'; my %options = ( 'key' => 'face', 'create' => 0, 'exclusive' => 0, 'mode' => 0644, 'destroy' => 0, ); # Print out a content-type for HTTP/1.0 compatibility #print "Content-type: text/html\n\n"; tie(%faceinfo, IPC::Shareable, $faceglue, { %options }) or die "$$: tie failed $!\n"; # Send last spoken string, initialize #print $faceinfo{stringfinger} . "\n"; #my $localtime = $faceinfo{timestamp}; if ($req->param('give') eq 'finger') { #&stuff; stuff(); } # faceServer has shut down #print "Shutdown\n"; exit; sub stuff { # Main loop # while ((defined(%faceinfo)) && (tied(%faceinfo))) { # if ($localtime != $faceinfo{timestamp}) { print $faceinfo{stringfinger} . "\n"; # $localtime = $faceinfo{timestamp}; # } # sleep for 250ms # select(undef, undef, undef, 0.25); # } }