Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: logging STDOUT of multiple scripts

by Cubes (Pilgrim)
on Jul 31, 2001 at 03:19 UTC ( [id://101015]=note: print w/replies, xml ) Need Help??


in reply to logging STDOUT of multiple scripts

You could do it in perl, but you might find it easier to just use something already on most (all?) *ix systems:
somecommand 2>&1 | tee logfile
Try man tee for more information.

update: I realized this answer is a bit terse and doesn't really answer the question. If you are actually looking for how to do it in perl, you will have to intercept output from the scripts (send that both to a file and to STDOUT), and the user's input, which will have to be passed along to the script. This can get tricky, expecially if your program doesn't know what should happen next (should it look for output from the script you just ran, or input from the user next?), but IPC::open2/open3 or Expect.pm can do what you want.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://101015]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-09-08 00:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.