#!/usr/bin/perl use warnings; use strict; use Tk; #read README.remote in mpg123 sources $|++; #my $pid = open(FH,"| mpg123 -R 2>&1 "); my $pid = open(FH,"| mpg123 -R >/dev/null 2>&1 "); print "$pid\n"; my $mw = new MainWindow; my $startbut = $mw->Button(-text =>'Start Play', -command => sub{ syswrite(FH, "LOAD 1bb.mp3\n") ; })->pack; my $pausebut = $mw->Button(-text =>'Pause', -command => sub{ syswrite(FH, "PAUSE\n") ; })->pack; my $exitbut = $mw->Button(-text =>'Exit', -command => sub{ exit })->pack; MainLoop; __END__ ######################################################## #OR with IPC::OPen3 ####################################################### #!/usr/bin/perl use warnings; use strict; use IPC::Open3; use Tk; #read README.remote in mpg123 sources $|++; my $pid = open3(\*WRITE,\*READ,0,"mpg123 -R 2>&1"); waitpid($pid, 1); my $mw = new MainWindow; my $t = $mw->Scrolled('Text', -bg=>'black',-fg=>'yellow')->pack; my $startbut = $mw->Button(-text =>'Start Play', -command => sub{ print WRITE "LOAD 1bb.mp3\n"; })->pack; my $pausebut = $mw->Button(-text =>'Pause', -command => sub{ print WRITE "PAUSE\n"; })->pack; my $exitbut = $mw->Button(-text =>'Exit', -command => sub{ exit })->pack; $mw->fileevent(\*READ, 'readable', [\&fill_text_widget,$t]); MainLoop; sub fill_text_widget { my($widget) = @_; my $text = ; $widget->delete('1.0','end'); $widget->insert('1.0',"$text"); $widget->yview('end'); } __END__