#!/usr/bin/perl # For Mac OS X only use strict; use warnings; use List::Util qw(shuffle); use CGI; my @VOICES = shuffle ( # men 'Alex', 'Bruce', 'Fred', 'Junior', 'Ralph', # women 'Agnes', 'Kathy', 'Princess', 'Vicki', 'Victoria', # other 'Albert', 'Bad News', 'Bahh', 'Bells', 'Boing', 'Bubbles', 'Cellos', 'Deranged', 'Good News', 'Hysterical', 'Pipe Organ', 'Trinoids', 'Whisper', 'Zarvox', ); my $q = CGI->new; my $voice = $q->param('voice') || $VOICES[0]; my $msg = $q->param('msg'); print $q->header(-type => 'text/plain'); if ($msg) { system('say', '-v', $voice, $msg) == 0 or die "say failed: $?"; print "I said $msg."; }