As I see it, you have 2 options here:
- Have your script pretend to be user interaction
- Control the STDIN filehandle
Your use of xautomation is an example of the first. There are other options in this category, however, I find these kinds of solutions to be kludgey in general.
Otherwise you have to control the STDIN filehandle. I know of no way of stealing the standard input of a process away from its initial input (although it is within the realm of the plausible). This leaves you with needing to open splay from Perl.
However, you can be pretty subtle about this if you are careful. Create an splay proxy program that mixes lines read from a named pipe (which you could map to the PID of the splay instance) into the STDIN. You could even replace your real splay with the proxy, moving the real thing to splay-bin or something to that effect. Now, if you want to insert lines into your splays STDIN, all you have to do is write to the named pipe and your proxy handles things nicely.