-my $sock = new IO::Socket::INET6(
- PeerAddr => $host,
- PeerPort => $port,
- Proto => 'tcp',
-) or die "failed to connect to MPD: $!";
-#binmode($sock, ":utf8");
-binmode($sock);
-
-if (!(<$sock> =~ /^OK MPD ([0-9]+)\.([0-9]+)\.([0-9]+)$/)) {
- die "MPD failed to announce version: $!";
-}
-
-sub mpd_escape {
- ($_) = @_;
-
- # No way to encode literal newlines in the protocol, so we convert
- # any newlines in the arguments into a space, which can help with
- # shell quoting.
- s/\n/ /g;
-
- if (/[ \t\\"]/) {
- s/[\\"]/\\$&/g;
- return "\"$_\"";
- }
- return $_;
-}