SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

BotDetect - Real-Time Bot Detection API
 
 

MAN page from Old RedHat 6.X perl-File-CounterFile-0.12-6.i386.rpm

CounterFile

Section: User Contributed Perl Documentation (3)
Updated: perl 5.005, patch 03
Index 

NAME

File::CounterFile - Persistent counter class 

SYNOPSIS

 use File::CounterFile; $c = new File::CounterFile "COUNTER", "aa00";
 $id = $c->inc; open(F, ">F$id");
 

DESCRIPTION

This module implements a persistent counter class. Each counter isrepresented by a separate file in the file system. File locking isapplied, so multiple processes might try to access the same countersat the same time without risk of counter destruction.

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

If the file name does not start with ``/'' or ``.'', then it isinterpreted as a file relative to $File::CounterFile::DEFAULT_DIR.The default value for this variable is initialized from theenvironment variable TMPDIR, or /usr/tmp is no environmentvariable is defined. You may want to assign a different value to thisvariable before creating counters.

If you pass a second parameter to the constructor, that sets theinitial value for a new counter. This parameter only takes effectwhen the file is created (i.e. it does not exist before the call).

When you call the inc() method, you increment the counter value byone. When you call dec() the counter value is decrementd. In bothcases the new value is returned. The dec() method only works fornumerical counters (digits only).

You can peek at the value of the counter (without incrementing it) byusing the value() method.

The counter can be locked and unlocked with the lock() andunlock() methods. Incrementing and value retrieval is faster whenthe counter is locked, because we do not have to update the counterfile all the time. You can query whether the counter is locked withthe locked() method.

There is also an operator overloading interface to theFile::CounterFile object. This means that you might use the ++operator for incrementing the counter, -- operator for decrementingand you can interpolate counters diretly into strings. 

BUGS

It uses flock(2) to lock the counter file. This does not work on allsystems. Perhaps we should use the File::Lock module? 

COPYRIGHT

Copyright (c) 1995-1998 Gisle Aas. All rights reserved.

This library is free software; you can redistribute it and/ormodify it under the same terms as Perl itself. 

AUTHOR

Gisle Aas <aasAATTsn.no>


 

Index

NAME
SYNOPSIS
DESCRIPTION
BUGS
COPYRIGHT
AUTHOR

This document was created byman2html,using the manual pages.
 
ICM Bot detect detector