Apache::Wyrd::Services::MetaTable - MySQL-backed Namespace-based data store
use base qw(Apache::Wyrd); use Apache::Wyrd::Services::MetaTable; my $mt = Apache::Wyrd::Services::MetaTable->new($self->dbl->dbh); my $lastrun = $mt->lastrun; ... do something with $lastrun value ... my $thisrun = `localtime` $mt->lastrun($thisrun);
MetaTable is an SQL-backed version of Apache::Wyrd::Services::Tree in terms of functionality, but is persistent across connections, as it stores its data in a MySQL server.
It can store hashes, arrays, and scalars. Pass the first two as references, the scalars as single values. It uses the namespace of the caller to decide the lookup key, so only the base name of the key need be specified, by referring to $meta_table->valuename (where $metatable stores a reference to an instance of this class). To retreive the value of 'valuename', call the method valuename(). To set it, call the method with a single argument.
Be careful to dispose the MetaTable handler properly across connections, or you run the risk of "leaking" database handles into your Apache memory space. The best way to avoid this is to invoke the MetaTable into a scoped lexical only.
invoke a new MetaTable. The dbh handle connection must have create and insert rights on the database. The name is optional, and defaults to _wyrd_meta.
Barry King <firstname.lastname@example.org>
General-purpose HTML-embeddable perl object
Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.
See LICENSE under the documentation for