in reply to Re: Text output is on one line
in thread Text output is on one line
eval will catch the exception caused by using flock where not supported and keep the program from dying. Just checking for $opsys eq "unix" is not sufficient - Perl does have flock on Windows NT f.ex, and there might be pathological cases where a system that identifies itself as unix does not. Catching the exception is a robust way to have it work wherever possible.use Fcntl qw(:flock); binmode FILE; eval { flock FILE, LOCK_EX };
Makeshifts last the longest.
|
|---|