thanks for your input. I've tried the $SIG{PIPE} and it is dying so it is happening. I've tried to simplify it into the following:
Module (Voice.pm):
package Voice; use IO::Socket; sub new { shift; my $self = {}; bless($self); return $self; } # end-new sub talk { $handle = IO::Socket::INET->new(Proto => "tcp", PeerAdr => "localhost", PeerPort => 1314) || die($!); print $handle "(SayText \"Testing.\")" || die($!); } # end-talk 1;
Script (test.cgi):
#!/usr/bin/perl use CGI qw(:header); print header; use Voice; my $voice = new Voice; $voice->talk; exit;
When I run test.cgi through a web browser I get nothing (even if the festival server is not running). When I run it from the command line, I get "broken pipe" regardless of whether the festival server is running or not.
The following script works just fine:
#!/usr/bin/perl use IO::Socket; $handle = IO::Socket::INET->new(Proto => "tcp", PeerAddr => "localhost", PeerPort => 1314) || die($!); print $handle "(SayText \"Testing.\")"; exit;
Being a newbie at perl modules my guess is that I've done something wrong in writing the module but I really dont know.

In reply to Re^2: Festival Module by rsiedl
in thread Broken Pipe error when talking to Festival server by rsiedl

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.