Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Downloaded the module and installed it
Have a mpg123 command.
Did the sample Perl script as
use Audio::Play::MPG123; my $player = new Audio::Play::MPG123; $player->load("a.mp3"); print $player->artist,"\n"; $player->poll(1) until $player->state == 0;

From the shell started the mpg123 command as
#>mpg123 -R a.mp3

From another shell executed the Perl script. Got the following error.
"connection to mpg123 process lost:"

Any corrections need to be done.
Please help me........

Replies are listed 'Best First'.
Re: Help to execute mpg123 command with Audio::Play::MPG123 package
by zentara (Cardinal) on Feb 20, 2010 at 12:30 UTC
    It works fine here with Perl 5.10. Linux, and alsasound.

    The first thing is determine if the module is buggy on your system, or if there is some other problem. The module code causing it is:

    if (defined $len || ($! != EAGAIN && $! != EINTR)) { die "connection to mpg123 process lost: $!\n" if $len == 0;
    Does the mpg123sh program (in the module's base directory) run? Maybe you are having trouble with filenames being passed in the pipes, like unicode mismatches or similar glitches.

    You said you ran the shell "mpg123 -R a.mp3" first. Could that interfere somehow? Like the soundcard being "in use"?


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku

      When mpg123sh was executing the same error has been get.
      "connection to mpg123 process lost"

      There was no interfere in mpg123 command execution

      Output of mpg123:
      #>mpg123 -R
      @R MPG123 (ThOr) v6

      Is there any compatibility error? Please help me.......

      Reference
      Perl Version is 5.8.8
      mpg123 command version is 1.10

        I didn't see any bug reports for that module, and it works here. All I can guess is that there is some odd piping problem on your system. Can you run the following?
        #!/usr/bin/perl system( "mpg123 a.mp3");

        I'm not really a human, but I play one on earth.
        Old Perl Programmer Haiku