I think that you will have to write a wrapper application that reads the executable output line by line and writes that output into a different logfile - as long as you can make the external application write everything to stdout/stderr, this should be possible. I don't have the time to create a working script, but here are some simple cases that could work (depending on the application) :
open APP, 'application.exe |' or die "Uhoh : $!";
while (<APP>) {
my $filename = get_logfilename_of_today;
open LOG, "<", $filename;
print LOG $_;
close LOG;
};
The above part only works if the application does not write to STDERR. perldoc perlipc suggests the following snipped if you need to read and write :
use FileHandle;
use IPC::Open2;
$pid = open2(*Reader, *Writer, "cat -u -n" );
print Writer "stuff\n";
$got = <Reader>;
If you need to read and write, also take a look at IO::Select.
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The
$d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider
($c = $d->accept())->get_request(); $c->send_response( new #in the
HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
|