#!/usr/bin/perl -w # # voiceClient # # Simple speech cue client. Command line version. # # Take passed string, emotional state?, put in voiceServer's # shm 'inbox'. use IPC::Shareable; # Clean up on untrapped signal error $SIG{INT} = \&catch_int; sub catch_int { print "Im a baaaad boy...\n"; exit; } my $cueglue = 'cuedata'; my %options = ( 'key' => 'cue', 'create' => 0, 'exclusive' => 0, 'mode' => 0664, 'destroy' => 0, ); # If tie fails, this probably means voiceServer isn't running. # Print error, and exit gracefully (almost) $knot = tie(%cueinfo, IPC::Shareable, $cueglue, { %options }) or die "$$: tie failed $!\n"; my $teststring = "This is a test of the emergency rubber chicken system."; $knot->shlock; $cueinfo{cuestring} = $teststring; $cueinfo{timestamp} = time(); $knot->shunlock; # done, print something usefull print "Sent-" . $cueinfo{cuestring} . "- at " . $cueinfo{timestamp} . "\n";