I have a Perl script that I would like to run on Windows using Strawberry Perl or ActivePerl ; I don't care what. However, this script uses calls flock()that do not seem to be included in any of these versions of Perl.
flock()
Can someone help launch and run?
Is the Fcntl module installed? Try the following:
perl.exe -MFcntl -e 1
If he complains, you do not have the Fcntl module installed. If it doesn't complain, you have access to Fcntl :: flock, so put this in your script:
use Fcntl qw(:DEFAULT :flock);
and from you.
perldoc -f flock, , , , . perldoc:
C: > perldoc -f flock
use Fcntl ':flock'; # import LOCK_* constant sub lock { flock(MBOX,LOCK_EX); # and, in case someone appended # while we were waiting... seek(MBOX, 0, 2); } sub unlock { flock(MBOX,LOCK_UN); } open(MBOX, ">>/usr/spool/mail/$ENV{'USER'}")