return $s;
}
+# Submit a command to the MPD server; each argument to this function
+# is quoted and sent as a single argument to MPD.
+sub exec {
+ my $cmd = join(' ', map { MPD::escape } @_);
+
+ print $sock "$cmd\n";
+}
+
+# Submit a command to the MPD server and wait for it to complete.
+# Intended for simple cases where the command output is unneeded.
+sub run {
+ MPD::exec(@_);
+ while (<$sock>) {
+ last if (/^OK/);
+ die($_) if (/^ACK/);
+ }
+}
+
1;