When developing against web services, I capture the server responses to disk and replay them from disk. That way, I get exactly reproducible results and errors, and it also helps me to separate the gathering of input from the program logic, as I have to be able to easily replace a socket connection with a filehandle.
If you're using any network based transfer and can install libpcap or Winpcap, using Net::Pcap to capture and feed your input makes replaying sessions very convenient, as long as they don't need any interactivity.