perl script open/save for voiceMessage problems

Discussion in 'Perl Misc' started by paul.hopgood@deathnotify.com, Feb 9, 2009.

  1. Guest

    I am trying to save a voiceMessage from a voiceXML script transfered
    via a BeVocal vxml script to a perl program located in a Yahoo web
    server that supports the perl language. I don't know exactly what path
    I need to name my file.My test.wav file does not create. Nothing
    happens. Any suggestions would be helpful.

    Here is my recording.pl file and what is currently coded in it:

    #!/usr/bin/perl -w

    use CGI qw:)standard);
    $|++;

    my $pathToRecordings='http://www.deathnotify.com/recordings';
    my $newRecording = 'test.wav';

    print header;

    open (SAVE, "> $deathnotify.com/recordings");
    binmode(SAVE);
    while (read(param('voiceMessage'),$data,1024))
    { print SAVE $data; }
    close(SAVE);

    # CONFIRM RECORDING WAS SAVED

    print <<INSERT_VXML;
    <?xml version="1.0"?>

    <vxml version="1.0">
    <form id="acceptInput">
    <block>
    Input was $ENV{'CONTENT_LENGTH'} bytes in length.
    The recording was processed and saved.
    <return/>
    </block>
    </form>
    </vxml>

    INSERT_VXML
    , Feb 9, 2009
    #1
    1. Advertising

  2. smallpond Guest

    On Feb 9, 2:43 pm, wrote:
    > I am trying to save a voiceMessage from a voiceXML script transfered
    > via a BeVocal vxml script to a perl program located in a Yahoo web
    > server that supports the perl language. I don't know exactly what path
    > I need to name my file.My test.wav file does not create. Nothing
    > happens. Any suggestions would be helpful.
    >
    > Here is my recording.pl file and what is currently coded in it:
    >
    > #!/usr/bin/perl -w
    >
    > use CGI qw:)standard);
    > $|++;
    >
    > my $pathToRecordings='http://www.deathnotify.com/recordings';
    > my $newRecording = 'test.wav';
    >
    > print header;
    >
    > open (SAVE, "> $deathnotify.com/recordings");
    > binmode(SAVE);
    > while (read(param('voiceMessage'),$data,1024))
    > { print SAVE $data; }
    > close(SAVE);
    >
    > # CONFIRM RECORDING WAS SAVED
    >
    > print <<INSERT_VXML;
    > <?xml version="1.0"?>
    >
    > <vxml version="1.0">
    > <form id="acceptInput">
    > <block>
    > Input was $ENV{'CONTENT_LENGTH'} bytes in length.
    > The recording was processed and saved.
    > <return/>
    > </block>
    > </form>
    > </vxml>
    >
    > INSERT_VXML



    This is going to surprise you. open, read and close all
    return something: namely, the answer to your question.
    smallpond, Feb 9, 2009
    #2
    1. Advertising

  3. J. Gleixner Guest

    wrote:
    > I am trying to save a voiceMessage from a voiceXML script transfered
    > via a BeVocal vxml script to a perl program located in a Yahoo web
    > server that supports the perl language. I don't know exactly what path
    > I need to name my file.My test.wav file does not create. Nothing
    > happens. Any suggestions would be helpful.
    >
    > Here is my recording.pl file and what is currently coded in it:
    >
    > #!/usr/bin/perl -w
    >
    > use CGI qw:)standard);


    forgot

    use strict;

    > $|++;
    >
    > my $pathToRecordings='http://www.deathnotify.com/recordings';
    > my $newRecording = 'test.wav';


    You never use either of these variables.

    >
    > print header;
    >
    > open (SAVE, "> $deathnotify.com/recordings");


    Where is $deathnotify defined?
    What if open() fails?

    That's why you 'use strict'.

    > binmode(SAVE);
    > while (read(param('voiceMessage'),$data,1024))
    > { print SAVE $data; }
    > close(SAVE);
    >
    > # CONFIRM RECORDING WAS SAVED
    >
    > print <<INSERT_VXML;
    > <?xml version="1.0"?>
    >
    > <vxml version="1.0">
    > <form id="acceptInput">
    > <block>
    > Input was $ENV{'CONTENT_LENGTH'} bytes in length.
    > The recording was processed and saved.
    > <return/>
    > </block>
    > </form>
    > </vxml>
    >
    > INSERT_VXML
    J. Gleixner, Feb 9, 2009
    #3
  4. <> wrote:

    > Any suggestions would be helpful.



    You should always enable strictures in Perl programs.


    > #!/usr/bin/perl -w



    use strict;


    > open (SAVE, "> $deathnotify.com/recordings");



    "use strict" would have found the bug in the line above if you
    had only asked it to...


    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
    Tad J McClellan, Feb 10, 2009
    #4
  5. Tad J McClellan wrote:
    > <> wrote:
    >
    > > Any suggestions would be helpful.

    >
    >
    > You should always enable strictures in Perl programs.



    True, as two others had posted over 3 hours befor you said as well.

    > > #!/usr/bin/perl -w

    >
    >
    > use strict;
    >
    >
    > > open (SAVE, "> $deathnotify.com/recordings");

    >
    >
    > "use strict" would have found the bug in the line above if you
    > had only asked it to...


    I wouldn't call it a bug, I'd call it sloppy copy-pasting and/or
    from-memory typing.
    Daniel Pfeiffer, Feb 11, 2009
    #5
  6. Daniel Pfeiffer <> wrote:
    > Tad J McClellan wrote:
    >> <> wrote:
    >>
    >> > Any suggestions would be helpful.

    >>
    >>
    >> You should always enable strictures in Perl programs.

    >
    >
    > True, as two others had posted over 3 hours befor you said as well.



    Usenet is not IM.


    >> > #!/usr/bin/perl -w

    >>
    >>
    >> use strict;
    >>
    >>
    >> > open (SAVE, "> $deathnotify.com/recordings");

    >>
    >>
    >> "use strict" would have found the bug in the line above if you
    >> had only asked it to...

    >
    > I wouldn't call it a bug,



    Wikipedia would (http://en.wikipedia.org/wiki/Software_bug)

    A software bug is an error, flaw, mistake, failure, or fault
    in a computer program that prevents it from behaving as intended

    and so would I.


    > I'd call it sloppy copy-pasting and/or
    > from-memory typing.



    The cause of a defect is not the same thing as the defect itself.


    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
    Tad J McClellan, Feb 11, 2009
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,766
  2. BusyBoy
    Replies:
    2
    Views:
    588
    =?Utf-8?B?TGVvbiBNYXluZQ==?=
    Oct 31, 2006
  3. tiewknvc9
    Replies:
    12
    Views:
    1,257
    Chris Uppal
    Feb 19, 2007
  4. Iain
    Replies:
    1
    Views:
    414
    Alexey Smirnov
    Apr 9, 2007
  5. eddie wang
    Replies:
    0
    Views:
    392
    eddie wang
    Oct 3, 2003
Loading...

Share This Page