in reply to Logging user input to a file, and passing it to an external program, at the same time
See Expect.
Update: Seriously, just use Expect. It's trivial...
use Expect; my $expect = Expect->spawn('/bin/bash'); $expect->log_file("./my.log"); $expect->interact();
You can give log_file() a code ref if you want to intercept the lines. That's how you might add time stamps, for example, but you'll have to write the lines out to your log too in that case.
|
|---|