UMMF::UML::Export::Perl::Tangram::Storage - Tangram Storage bridge for UMMF generated Perl code.
This package provides tools for using Tangram Storage objects transparently with UMMF-generated Perl code.
use UMMF::UML::Export::Perl::Tangram::Storage; $cls->get('name' => 'foo'); $cls->get_or_new('name' => 'foo'); $cls->get_or_error('name' => 'foo'); $obj->__storage_insert(); $obj->__storage_erase(); $obj->__storage_update();
None exported.
Kurt Stephens, kstephens@users.sourceforge.net 2004/03/29
UMMF::UML::Export::Perl::Tangram
$Revision: 1.19 $
$storage->flush_get_cache(@cls);
Flushes the get cache for all classes in @cls.
@cls
$storage->flush_get_cache();
Flushes the entire get cache.
$storage->flush_cache();
Flushes the entire get cache and disassembles any objects in the storage's object cache that may have circular references.
This is typically done at the end of an interaction (i.e via CGI, etc.) in a server-type application.
my ($dsn, $user, $pass) = $storage->connect_opts();
Returns a list of parameters suitable for DBI->connect($dsn, $user, $pass).
$storage->set_dbh($dbh);
Sets a cached DBD connection, using connect_opts().
connect_opts()
$dbh-disconnect> is not called from $storage-disconnect>.
$dbh-
$storage-
my $dbh = $storage->dbh();
Returns a cached DBD connection, using connect_opts().
If $dbh was not specified by set_dbh, it is subject to $dbh->disconnect when $storage->disconnect is called.
$dbh
set_dbh
$self->insert(@objs);
Inserts all objects in @obj into the storage. Caching is flushed for all objects of the class of the objects inserted..
@obj
$self->update(@objs);
Updates all objects in @obj into the storage. Caching is flushed for all objects of the class of the objects inserted..
$self->update_or_insert(@objs);
Updates all objects in @obj into the storage. Any objects which are not already inserted into the storage are inserted. Caching is flushed for all objects of the class of the objects inserted..
$self->erase(@objs);
Erases all objects in @obj from the storage. Caching is flushed for all objects of the class of the objects erased.
my @objs = $self->load(@ids);
Loads all objects from storage via unique object ids.
my $id = $self->id($obj); my @ids = $self->id(@objs);
Returns the unique id for the object in storage.
my $cls_expr = $self->class($cls);
Returns a new class expression that represents all objects in the storage that are of the class $cls.
$cls
my @objs = $self->select($cls_expr, $filter, @opts);
Returns all objects of $cls_expr that match $filter.
$cls_expr
$filter
my $cursor = $self->cursor($cls_expr, $filter, @opts);
Returns an iterator of all objects of $cls_expr that match $filter.
my $count = $self->count($filter, @opts);
Returns the count of all objects that match $filter.
my $sum = $storage->sum($expr, $filter); my @sums = $storage->sum([$expr1, $expr2], $filter);
Returns the sum of all $expr values of all objects that match $filter.
$expr
$storage->disconnect();
Flushes the get cache. Disconnects the underlying storage and any database connections.
Calls disconnect() upon GC.
disconnect()
my $objs = $self->get_all($cls, \%keys); my @objs = $self->get_all($cls, \%keys);
Returns all matching object of class $cls that match %keys exactly.
%keys
my $objs = $self->get_all($cls, \%keys);
Returns one matching object of class $cls that match %keys exactly. If more than one object matches, an error is thrown via die(). Any object found is stored in a cache.
die()
my $objs = $self->get_foce($cls, \%keys);
Returns one matching object of class $cls that match %keys exactly. If more than one object matches, an error is thrown via die(). No caching is used.
Returns one matching object of class $cls that match %keys exactly. If no object is found, an error is thrown via die(). Caching is used.
my $objs = $self->get_or_new($cls, \%keys, \%inits);
Returns one matching object of class $cls that match %keys exactly. If no object is found, a new object is created with the %keys and %inits and is inserted in the storage. Caching is used.
%inits
my $hash = $cls->__storage_opts;
Returns the hash of storage options used when a new Storage objects is created by __storage.
__storage
sub conn_opt_callback { my ($opts, $storage_conn_id) = @_; $opts->{'db'} = 'blahblah'; ...; } $cls->__storage_set_opts_callback(\&func);
Sets the function to use when calling
$cls->__storage_set_conn_id('some_connection_name');
Sets the current connection id to use for the remainder of the process. Returns the previous connection id.
my $storage = $cls_or_obj->__storage();
Returns the current Perl::Tangram::Storage object for $cls_or_obj for the current connection id. If a storage object has not been created for the current connection id, a new one is created using the initial options from __storage_opts().
Perl::Tangram::Storage
$cls_or_obj
__storage_opts()
my $storage = $cls_or_obj->__storage_disconnect();
Disconnects the $cls_or_obj from its current Storage object. All object caches are flushed and the Storage object is dropped.
$cls_or_obj->__storage_flush_cache();
Flushes object caches in the current Storage object, if any. This is ideally done at the end of an interactive session.
$obj->__storage_update();
Shorthand for:
$obj->__storage->update($obj);
$obj->__storage_update_or_insert();
$obj->__storage->update_or_insert($obj);
$obj->__storage_erase;
$obj->__storage->erase($obj);
$obj->__storage_insert();
$obj->__storage->insert($obj);
my @objs = $cls->get_all(%key);
$cls->__storage->get_all($cls, \%key);
my $obj = $cls->get_al(%key);
my $obj = $cls->__storage->get($cls, \%key);
my $obj = $cls->get_or_error(%key);
my $obj = $cls->__storage->get_or_error($cls, \%key);
my $obj = $cls->get_or_new(%key);
my $obj = $cls->__storage->get_or_new($cls, \%key);
my $obj = $cls->get_or_new(\%key, \%init);
my $obj = $cls->__storage->get_or_init($cls, \%key, \%init);
my $obj = $cls->get_force(%key);
my $obj = $cls->__storage->get_force($cls, \%key);
To install UMMF, copy and paste the appropriate command in to your terminal.
cpanm
cpanm UMMF
CPAN shell
perl -MCPAN -e shell install UMMF
For more information on module installation, please visit the detailed CPAN module installation guide.