[LA.pm] does system() wait?

cch cch2cch at netscape.net
Wed Feb 23 07:43:35 PST 2005


Thanks all for your response. Yes, it is more a realplayer issue. 
Actually I can play several songs with one call:  system("... 
realplayer  song1.mp3 song2.mp3 .."); but I want to play a long list.
Incidentally, for you guys who have realplayer on unix/linux ( 
realplayer crashes my redhat) I wonder what it will do with this:
cat songlist| xargs realplayer

jleader at alumni.caltech.edu wrote:

> cch2cch at netscape.net wrote:
>
>> Hi,
>>
>> I  am running activePerl 5.6 on win98se. When I run these statements:
>>
>> system("...realplayer  song1.mp3");
>> system("...realplayer  song2.mp3");
>> system("...realplayer song3.mp3");
>>
>> I expect the three songs to be played in sequence. Instead only song3 is
>> played. It seems all three system() function are executed but one
>> overrides the other. I  believe Perl waits for system() to  finish  
>> before continuing. Is it not so in the PC environment? Thanks
>
>
> Yes, system does a fork, exec, wait (or some rough equivalent).
>
> However, I don't know what the semantics of calling "...realplayer" are.
> Some programs perform an action, and don't exit/return to the caller
> until the action is done.  Other programs are just interfaces to some
> daemon process, and will exit/return as soon as they've relayed the
> appropriate command to the daemon process.  My guess is that realplayer
> does the latter, so each invocation to "...realplayer" just sends a
> command to the realplayer daemon to tell it to start a new song.
>
> There might be an option to "...realplayer" to tell it to wait until
> the song finishes before returning, I don't know.  Or, there might
> be some interface you could call which would tell you the currently
> playing song, and your script would have to loop, checking which song
> is playing and sleeping until it's time to start the next song.
>



More information about the Losangeles-pm mailing list