Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

vend::counterfile(3pm) [debian man page]

Vend::CounterFile(3pm)					User Contributed Perl Documentation				    Vend::CounterFile(3pm)

NAME
Vend::CounterFile - Persistent counter class SYNOPSIS
use Vend::CounterFile; $c = new Vend::CounterFile "COUNTER", "aa00"; $id = $c->inc; open(F, ">F$id"); DESCRIPTION
(This module is modified from Gisle Aas File::CounterFile to use Interchange's locking protocols -- lack of fcntl locking was causing counter problems.) 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 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 $Vend::CounterFile::DEFAULT_DIR. The default value for this variable is initialized from the environment variable "TMPDIR", or /usr/tmp is no environment variable is defined. You may want to assign a different value to this variable before creating counters. 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 "inc()" method, you increment the counter value by one. When you call "dec()" the counter value is decrementd. 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 is 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()" method. There is also an operator overloading interface to the Vend::CounterFile object. This means that you might use the "++" operator for incrementing the counter, "--" operator for decrementing and you can interpolate counters diretly into strings. BUGS
(This problem alleviated by this modified module) It uses flock(2) to lock the counter file. This does not work on all systems. Perhaps we should use the File::Lock module? COPYRIGHT
Copyright (c) 1995-1998 Gisle Aas. All rights reserved. Modifications made by and copyright (C) 2002 Red Hat, Inc. and (c) 2002-2007 Interchange Development Group This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AUTHOR
Gisle Aas <aas@sn.no> perl v5.14.2 2010-03-25 Vend::CounterFile(3pm)

Check Out this Related Man Page

Vend::Table::Editor(3pm)				User Contributed Perl Documentation				  Vend::Table::Editor(3pm)

NAME
Vend::Table::Editor -- Interchange do-all HTML table editor SYNOPSIS
[table-editor OPTIONS] [table-editor OPTIONS] TEMPLATE [/table-editor] DESCRIPTION
The [table-editor] tag produces an HTML form that edits a database table or collects values for a "wizard". It is extremely configurable as to display and characteristics of the widgets used to collect the input. The widget types are based on the Interchange "[display ...]" UserTag, which in turn is heavily based on the ITL core "[accessories ...]" tag. The "simplest" form of "[table-editor]" is: [table-editor table=foo] A page which contains only that tag will edit the table "foo", where "foo" is the name of an Interchange table to edit. If no "foo" table is "defined", then nothing will be displayed. If the "mv_metadata" entry "foo" is present, it is used as the definition for table display, including the fields to edit and labels for sections of the form. If "ui_data_fields" is defined, this cancels fetch of the view and any breaks and labels must be defined with "ui_break_before" and "ui_break_before_label". More on the view concept later. A simple "wizard" can be made with: [table-editor wizard=1 ui_wizard_fields="foo bar" mv_nextpage=wizard2 mv_prevpage=wizard_intro ] The purpose of a "wizard" is to collect values from the user and place them in the $Values array. A next page value (option mv_nextpage) must be defined to give a destination; if mv_prevpage is defined then a "Back" button is presented to allow paging backward in the wizard. perl v5.14.2 2011-03-09 Vend::Table::Editor(3pm)
Man Page