Liz::CounterSet - CounterSet module
use Liz::CounterSet;
$counterset = new Liz::CounterSet;
#!/usr/local/bin/perl
use Liz::CounterSet;
The Liz::CounterSet package allows for very simple countersets kept in the client database.
The following methods can be called without an object specification, but as a class method such as Liz::CounterSet->method().
Return list of counterset identification names of all countersets in the database specified. Usually not called by itself, but rather incorporated inside a Client Module.
1 wildcard specification to match (default: all) 2 Liz::SQL compatible handle or reference to routine that performs connect (default: &Connect from caller's namespace)
1 reference to list of identification names in the current database 2 reference to hash with full names
$counterset = $hn->CounterSet( 'technology' );
$hn = new HN;
($id,$name) = $hn->CounterSets;
$countersets = @{$id};
print "All $countersets countersets in Hospitality Net:\n";
foreach( 0..$#$id ) {
print " CounterSet '$$name[$_]' ($$id[$_])\n";
}
In HN.pm:
sub CounterSets { Liz::CounterSet->countersets( $_[1],$_[0] ) }
Create a new Liz::CounterSet object. Creates connection or re-establishes connection with the MySQL database. Usually not called by itself, but rather incorporated inside a Client Module.
1 identification name of counterset (default: default counterset for database) 2 Liz::SQL compatible handle or reference to routine that performs connect (default: &Connect from caller's namespace)
1 instantiated object
$hn = new HN; $counterset = $hn->CounterSet( 'technology' );
In HN.pm:
sub CounterSet { Liz::CounterSet->new( $_[1],$_[0] ) }
The following methods allow changes to information that is associated with an entire counterset.
Count a reference to a string, usually the name of the page on the filesystem (as known by $ENV{'SCRIPT_FILENAME'}).
1 value to set
(default: one more than current)
2 reference to count for
(default: $ENV{'SCRIPT_FILENAME'})
1 current value 2 timestamp when counterset was created 3 timestamp when counterset was updated (now)
$hn = new HN; $counterset = $hn->CounterSet( 'technology' ); $seen = $counterset->Count;
Elizabeth Mattijsen ( lizperl@INC.nl )
(C) 1998-1999 International Network Consultants
Now no longer puts Exporter in ISA: it wasn't necessary.
Method countersets now reduced to a call to Liz::SQL's ``sets''.
Method new now calls Liz::SQL's ``new'' to create object.
Changed CREATE TABLE to a call to the new Liz::SQL 'create' method.
Changed to new source typography.
Changed from using method ``Exists'' to ``Count'' in method new to determine whether a table exists or not.
Fixed problem in countersets which would prevent the counterset with the default identification name.
Fixed problem introduced on October 6th.
Reduced memory footprint by fully qualifying global variables.
First version of this true Perl module.