File::CounterFile - Persistent counter class
use File::CounterFile; $c = new File::CounterFile "COUNTER", "aa00";
$id = $c->inc; open(F, ">F$id");
This module implements a persistent counter class. Each counter is represented by a separate file in the file system. File locking is applied, so multiple processes might try to access the same counters at the same time without risk of counter destruction.
You give the file name as the first parameter to the object
If the file name does not start with ``/'' or ``.'', then it is
interpreted as a file relative to
If you pass a second parameter to the constructor, that sets the initial value for a new counter. This parameter only takes effect when the file is created (i.e. it does not exist before the call).
When you call the
You can peek at the value of the counter (without incrementing it) by
The counter can be locked and unlocked with the
There is also an operator overloading interface to the
File::CounterFile object. This means that you might use the
Copyright (c) 1995-1998 Gisle Aas. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Gisle Aas <email@example.com>