Greetings esteemed Monks,

I'm trying to get Text to Speech working in perl on a Win32 box, but I'm running into an "Invalid class string" error. First, here are my vitals:

OS: MS Professional XP, service pack 1.
Perl: ActivePerl v5.8.4, Binary build 810
Win32-OLE: version 0.1403, installed with ppm

I'm working with the verified code from this thread. Here's the code:
use strict; use warnings; use Win32::OLE; # Set up speech. my $voice = Win32::OLE->new("Speech.VoiceText") or die("TTS failed"); $voice->Register("", "$0"); $voice->{Enabled} = 1; # optional my $question = <<__EOS__; Shall we play a game? __EOS__ my $answer = <<__EOS__; How about Global Thermonuclear Text to Speech. __EOS__ $voice->Speak($question, 1); $voice->Speak($answer, 1); while ($voice->IsSpeaking()) { sleep 1; }

When I run this code, I get the following error message:
C:\Apps\Perl\dev>perl speech.pl Win32::OLE(0.1403) error 0x800401f3: "Invalid class string" at speech. +pl line 7 eval {...} called at speech.pl line 7 TTS failed at speech.pl line 7.
Line 7 is the Win32::OLE->new call. This looks like a module dependency error. If I'm reading this error correctly, the OLE module is trying to instantiate a string, and the class is not defined. So I reran ppm, did a search for string, and found 111 results. I installed Set-String, but I still get this error. Is this a module dependency error, and if so, what module do I need to install to prevent this error? Is ppm smart enough to grab missing dependent modules at install time?

Thanks for your help,
TROGDOR

In reply to Text to Speech Win32::OLE Error by TROGDOR

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.