]> git.draconx.ca Git - mpdhacks.git/blobdiff - MPDHacks.pm
Factor out mpd_exec from some of the perl scripts.
[mpdhacks.git] / MPDHacks.pm
index 94c0acc518dbad5067eb1c4456c4877ee169955d..0f5026eb237e7d9f60f3861cbbbc9d0cc6e268b9 100644 (file)
@@ -107,4 +107,12 @@ sub escape {
        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";
+}
+
 1;