|
|
| Welcome to the Monastery | |
| PerlMonks |
Re: Thread safe equivalent of LINUX touch commandby flexvault (Vicar) |
| on Nov 22, 2012 at 14:59 UTC ( #1005142=note: print w/ replies, xml ) | Need Help?? |
|
I have a common module that includes the following:
In your code you call it the same way as you do now. Make sure you have the ">>" or you'll clear the file. Note: On some older *nix systems, I've had to actually do I/O to the file. In that case, I'd 'print' a "\n" to the end before closing. I didn't like that solution, but it did work and didn't cause any *KNOWN* problems. I have used mostly 'fork', so I've never tried this with Threads, so others may suggest an alternative, but this works and is faster than calling the system 'touch'. 'Die_Rtn' is also in the common module and determines if the failure is for the user or the system and acts accordingly. Hope this helps! "Well done is better than well said." - Benjamin Franklin
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||