Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Sunday November 17, 2002
04:27 AM

Tell me everything

[ #8991 ]

Right after I posted my thoughts on speech multiplexers, I had another idea. Would perl errors be easier to deal with if Marlene Deitrich spoke them to me? I cannot actually do that a the moment, but that stuff Kevin Lenzo works on can probably create the voice and all that. I can; however, use one of the Mac's voices.

I wrote a simple program to speak whatever I give it as input. I set the MAC_VOICE environment variable to one of the voices in the Speech panel of System Preferences. I name the program "speak".

use Mac::Speech;
my $Default_voice = 'Victoria';
my $voice = $Mac::Speech::Voice{ $ENV{MAC_VOICE} || 'Victoria' };
my $channel = NewSpeechChannel($voice);
SpeakText( $channel, '' );
while( <> )
    SpeakText( $channel, $_ );
    sleep 1 while SpeechBusy();

I created a perl program that would generate an error. Since I use strict, I have to declare all of my variables somehow. In this program I do not do that, so I should get an error.

use strict;
$x = 1;

When I run this program, I get an error. The particular error may vary by your version of Perl.

Global symbol "$x" requires explicit package name at line 4.
Execution of aborted due to compilation errors.

I redirect this to speak. Since perl errors show up on standard error I redirect that to standard output (2>&1) so I can pipe it to speak.

g3_brian[1121]$ perl 2>&1 | speak

Is the error message any easier to take? Well, not really. I want to throttle the speaker, actually. Maybe I can experiment with the voice timing and whatnot to make it better.

Just for fun I redirected the text to an upcoming article into speak. Despite the goofy voice, I could understand most of the text. This could be really handy---instead of reading the article yet another time, I listen to it. The new experience should help me catch things I missed with my eyes.

Along the same lines, but for another day:

  • speaking Eliza
  • speaking IRC
  • speaking email
  • speaking regular expressions
  • speaking perl5db