Hello, I have just signed up to the site and I am also very new to perl but very interested. My question is how to run a loop in the background of my main program... I personaly want to play songs in a playlist (one starts after the other is done) while I goto(); another part of my program while maintaining the loop. (i am using Win32::MediaPlayer to play the music) here is my code (sub program that gets required into my main code):
while (($music_playlist_line_number, $music_file) = each(%AllFiles)){ $winmm = new Win32::MediaPlayer; $winmm->load("User Files\\$name\\Pro Playlist\\$music_file"); $winmm->play; $winmm->volume($volume); $song_length_micro = $winmm->length; $song_length = ($song_length_micro * .001) + .05; ### + .05 second buffer between songs; $song_pos_micro = $winmm->pos; sleep ($song_length); }
now, this code works for me however im not able to go somwhere in my program while it keeps going to different songs after Im there. I can do it with single songs, they will keep playing but I would need to run this in some kind of background process for it to keep working, independent on the main program but able to use the main programs variables and hashes I use to make it work.
In reply to Looping in the background of your main program by Baphi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |