Apache::Wyrd::Services::MetaTable is a MySQL-backed Namespace-based data store.
use base qw(Apache::Wyrd);
my $mt = Apache::Wyrd::Services::MetaTable->new($self->dbl->dbh);
my $lastrun = $mt->lastrun;
... do something with $lastrun value ...
my $thisrun = `localtime`
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.
new(dbh handle, scalar name)
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.