in reply to Re^2: perl file handle share thread
in thread perl file handle share thread

i would like to know how could i open and close this file in one thread and it will affect all the other threads that are writing to this file handle.

That is exactly what my posted code showed you how to do. If all your threads are using a well-known handle (like STDERR) for logging, then all you need to do is re-open that to the new file and all the other threads will be redirected to that new file. (You should also use some locking for safety!)

If you are using some kind of object-based wrapper or (dratted) singleton instance to obtain or supply the handle, then you will have to post a (small) working snippet that demonstrates what you are doing. We can then look at what needs to be done to make that work for you.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy