Liz::EventSet - EventSet module
use Liz::EventSet;
$file = new Liz::EventSet;
#!/usr/local/bin/perl
use Liz::EventSet;
The Liz::EventSet package allows for very simple storage of sets of events. As such it can function as a database for events associated with a client or a project.
The Liz::EventSet module itself works best when incorporated into a client module because it moves the responsibility of aquiring a connection to a database to the client module and it allows any customisation to take place transparently to the developer.
Take for example the EventSet method of HN.pm module:
sub EventSet {
# Obtain the parameters # Start the file using the $hn handle as the database handle # Return the finished object
my( $hn,$token ) = @_; my( $eventset ) = Liz::EventSet->new( $token,$hn ); $eventset; }
Because of the above code in HN.pm, it is now possible to write the following code:
$hn = new HN; $eventset = $hn->EventSet( 'technology' );
Note that the database connection of the file is hidden in the creation of
the $hn object.
The following methods can be called without an object specification, but as a class method such as Liz::EventSet->method().
Return list of file identification names of all eventsets 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
$hn = new HN;
($id,$name) = $hn->EventSets;
$eventsets = @{$id};
print "All $eventsets eventsets in Hospitality Net:\n";
foreach( @{$id} ) {
print " EventSet '$$name{$_}' ($_)\n";
}
In HN.pm:
sub EventSets { Liz::EventSet->eventsets( $_[1],$_[0] ) }
Create a new Liz::EventSet 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 file set (default: default file set for database) 2 Liz::SQL compatible handle or reference to routine that performs connect (default: &Connect from caller's namespace)
1 instantiated object 2 flag: whether the EventSet was just created
$hn = new HN; $file = $hn->EventSet( 'technology' );
In HN.pm:
sub EventSet { Liz::EventSet->new( $_[1],$_[0] ) }
The following methods allow changes to information that is associated with an entire eventset.
Quickly add an event to an EventSet without having to open a separate Liz::EventSet::Event object.
1 originatorID 2 description (default: none) 3 options (default: none) 4 status (default: 0, between 0..255)
1 ID with which the Event was created
$vsb->EventSet( 'folders' )->AddEvent( $contactID,$self );
Specify or return the current name of the eventset object. The name can be anything to further identify the goal of the eventset.
1 new name of eventset (default: no change)
1 current/old name of eventset
$xxlink = new xxLINK; $eventset = $xxlink->EventSet( 'eurest' ); $eventset->Name( 'Eurestjes' );
The following methods allow changes to a single event in a EventSet.
Create a new Liz::EventSet::Event object, either from existing information or for a new entry. For more documentation, see the Liz::EventSet::Event object itself.
1 ID/name to create Event object with (default: none = new file) 2 sortname of event (default: same as name if 1st parameter is name)
1 instantiated Event object
$hn = new HN; $eventset = $hn->EventSet( 'technology' );
$event = $eventset->Event; $event = $eventset->Event( 'Toilet Seats' ); $event = $eventset->Event( $eventID );
Return an SQL statement handle for a list of events.
The following fields may be specified with the 2nd parameter:
ID The ID of the event
originatorID The ID of the originator of the event
description The description of the event
IP Packed IP-number of originator
created Timestamp value when this file was created
updated Timestamp when the file was last updated
options Options associated with the file
status The status of this file
1 fields to return (comma delimited) (default: 'ID,originatorID,description,IP,created,updated,options,status' ); 2 fieldname on which to order the result (default: 'created') 3 extra condition to be applied (default: none)
1 SQL statement handle (on which method "fetchrow" can be applied)
Elizabeth Mattijsen ( lizperl@INC.nl )
(C) 1998-1999 International Network Consultants
Put module name between quotes to fix obscure bug in Perl 5.005x under ModPerl in method Event.
Now no longer adds Exporter to ISA: it wasn't necessary.
Adapted method new so that any extra fields are handled correctly.
Class methods eventsets now just calls Liz::SQL's ``sets''.
Removed dependency on local GetSetMeta internal subroutine and replaced this with a call to the new method TableMeta of the Liz::SQL module.
Changed all CREATE TABLEs to method calls to the new Liz::SQL 'create' method.
Changed typography to new format.
Changed from using method ``Exists'' to ``Count'' in method new to check for the existence of a table more quickly.
First version of this true Perl module. Copied from the Liz::FileSet module, which is less general than this.