File::CounterFile man page on HP-UX

Man page or keyword search:  
man Server   10987 pages
apropos Keyword Search (all sections)
Output format
HP-UX logo
[printable version]

CounterFile(3)	      User Contributed Perl Documentation	CounterFile(3)

       File::CounterFile - Persistent counter class

	use File::CounterFile;
	$c = File::CounterFile->new("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 can attempt to access a counter simulta‐
       neously without risk of counter destruction.

       You give the file name as the first parameter to the object constructor
       ("new").	 The file is created if it does not exist.

       If the file name does not start with "/" or ".", then it is interpreted
       as a file relative to $File::CounterFile::DEFAULT_DIR.  The default
       value for this variable is initialized from the environment variable
       "TMPDIR", or /usr/tmp if no environment variable is defined.  You may
       want to assign a different value to this variable before creating coun‐

       If you pass a second parameter to the constructor, it 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 "inc()" method, you increment the counter value by
       one. When you call "dec()", the counter value is decremented.  In both
       cases the new value is returned.	 The "dec()" method only works for
       numerical counters (digits only).

       You can peek at the value of the counter (without incrementing it) by
       using the "value()" method.

       The counter can be locked and unlocked with the "lock()" and "unlock()"
       methods.	 Incrementing and value retrieval are faster when the counter
       is locked, because we do not have to update the counter file all the
       time.  You can query whether the counter is locked with the "locked()"

       There is also an operator overloading interface to the File::Counter‐
       File object.  This means that you can use the "++" operator for incre‐
       menting and the "--" operator for decrementing the counter, and you can
       interpolate counters directly into strings.

       Copyright (c) 1995-1998,2002,2003 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 <>

perl v5.8.8			  2004-01-23			CounterFile(3)

List of man pages available for HP-UX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net