[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] file-locking algorithm (Files.pm bug)



There's another way to lock a file:

#!perl -w
use Mac::Files;
$f = 'PowerPudge:Desktop Folder:test.scr copy';
sub lockfile   {FSpSetFLock $f}
sub unlockfile {&Mac::Files::FSpRstFLock($f)}

lockfile;
print "Locked\n" if (! open(T,">$f"));close(T);
unlockfile;
print "Unlocked\n" if (open(T,">$f"));close(T);


NOTE: the error is that three methods are called 'FSpGetFInfo' in the
Files.xs documentation and exported by Files.pm as such.  You can access
them directly by calling the explicit package name as above for
FSpRstFLock.

The three methods are FSpSetFInfo, FSpRstFLock and FSpGetFInfo.
FSpGetFInfo works without calling it explicitly, because it has the proper
name exported.

--
Chris Nandor                 pudge@pobox.com                 http://pudge.net/
%PGPKey=('B76E72AD',[1024,'08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6'])



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch