in reply to Net::OpenSSH and tail -f
The tail -f will run remotely, so I don't think you'll have access to it's PID. Killing it that way might require another ssh connection.
If the process runs in shell you might be able to send it a ctrl-c to kill it.