#!/usr/bin/perl $| = 1; use Audio::Play::MPG321; $player = new Audio::Play::MPG321; $SIG{CHLD} = 'IGNORE'; $SIG{INT} = sub { $player->stop(); exit 1; }; do { while (1) { $player->poll(); select(undef, undef, undef, 0.5); } } unless fork(); while (1) { print "\n> "; chomp(my $in = ); my ($method, @args) = split(/\s+/, $in); $player->$method(@args); print $player->state(), "\n"; }