3 # Copyright © 2012 Nick Bowler
5 # Simple program to send a command to MPD. The result is printed to standard
8 # License WTFPL2: Do What The Fuck You Want To Public License, version 2.
9 # This is free software: you are free to do what the fuck you want to.
10 # There is NO WARRANTY, to the extent permitted by law.
16 use IO::Socket::INET6;
18 my $host = $ENV{MPD_HOST} // "localhost";
19 my $port = $ENV{MPD_PORT} // 6600;
21 my $sock = new IO::Socket::INET6(
25 ) or die "failed to connect to MPD: $!";
26 binmode($sock, ":utf8");
28 if (!(<$sock> =~ /^OK MPD ([0-9]+)\.([0-9]+)\.([0-9]+)$/)) {
29 die "MPD failed to announce version: $!";
32 print $sock join(' ', @ARGV), "\n";
39 print $sock "close\n";