IO::LockedFile

Supply object methods for locking files
Download

IO::LockedFile Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Rani Pinchuk
  • Publisher web site:
  • http://search.cpan.org/~rani/Class-Phrasebook-0.88/SQL/SQL.pm

IO::LockedFile Tags


IO::LockedFile Description

Supply object methods for locking files IO::LockedFile Class is a Perlsupply object methods for locking filesSYNOPSIS use IO::LockedFile; # create new locked file object. $file will hold a file handle. # if the file is already locked, the method will not return until the # file is unlocked my $file = new IO::LockedFile(">locked1.txt"); # when we close the file - it become unlocked. $file->close(); # suppose we did not have the line above, we can also delete the # object, and the file is automatically unlocked and closed. $file = undef;In its simplistic use, the IO::LockedFile class gives us the same interface of the IO::File class with the unique difference that the files we deal with are locked using the Flock mechanism (using the flock function).If during the running of the process, it crashed - the file will be automatically unlocked. Actually - if the IO::LockedFile object goes out of scope, the file is automatically closed and unlocked.So, if you are just interested in having locked files with flock, you can skip most of the documentation below.If, on the other hand, you are interested in locking files with other schemes then Flock, or you want to control the behavior of the locking (having non blocking lock for example), read on.Actually the class IO::LockedFile is kind of abstract class.Why abstract? Because methods of this class call the methods lock and unlock. But those methods are not really implemented in this class. They suppose to be implemented in the derived classes of IO::LockedFile.Why "kind" of abstract? Because the constructor of this class will return an object!How abstract class can create objects? This is done by having the constructor returning object that is actually an object of one of the derived classes of IO::LockedFile. Requirements: · Perl


IO::LockedFile Related Software