View Full Version : [Perl? commandline?] sending WAV to default audio output

13th December 2004, 01:57 PM
I have a perl script working with my superkaramba to check my mail frequently. I was wondering how can I plug in a command to play a WAV file whenever a mail comes.

use Net::POP3;

my $ServerName = $ARGV[0];

# If your username contains a @ character you
# must replace it with \@
my $UserName = $ARGV[1];
my $Password = $ARGV[2];
my $pop3 = Net::POP3->new($ServerName);

if (!$pop3) {
print "Błąd";

my $Num_Messages = $pop3->login($UserName, $Password) + 0;

if ( $Num_Messages == 1 ){
print $Num_Messages ." wiadomości\n";
elsif ( $Num_Messages > 1 ){
print $Num_Messages ." wiadomości\n";
print "0 wiadomości\n";


13th December 2004, 02:53 PM
I did something similar with python by piping a sound stream directly to the "play" command (or 'aplay', if you're using ALSA) (this was before I discovered python has a sound-module included, as I sure perl has too ...). Since you've already got you sound file, just execute "play mysound.wav" as a shell command from perl.

13th December 2004, 03:27 PM
I have never programmed Perl :(
tried exec("play mail.wav"); and system ("play mail.wav"); and `play mail.wav`; - didn't make it.

13th December 2004, 04:08 PM
Can't really hepl u with perl. ur one of the only people online just wonderin if u can help me with some topics?

13th December 2004, 04:43 PM
@Drine: I'm afraid I don't get you, forget it