NAME
Yote::ObjProvider - Serves Yote objects. Configured to a persistance engine.
DESCRIPTION
This module is the front end for assigning IDs to objects, fetching objects, keeping track of objects that need saving (are dirty) and saving all dirty objects.
The public methods of interest are
- fetch
-
Returns an object given an id.
my $object = Yote::ObjProvider::fetch( $object_id );
- xpath
-
Given a path designator, returns the object at the end of it, starting in the root. The notation is /foo/bar/baz where foo, bar and baz are field names.
For example, get the value of the hash keyed to 'zap' where the hash is the second element of an array that is attached to the root with the key 'baz' :
my $object = Yote::ObjProvider::xpath( "/baz/1/zap" );
- xpath_count
-
Given a path designator, returns the number of fields of the object at the end of it, starting in the root. The notation is /foo/bar/baz where foo, bar and baz are field names. This is useful for counting how many things are in a list.
my $count = Yote::ObjProvider::xpath_count( "/foo/bar/baz/myarray" );
- a_child_of_b
-
Takes two objects as arguments. Returns true if object a is branched off of object b.
if( Yote::ObjProvider::xpath_count( $obj_a, $obj_b ) ) {
- stow_all
-
Stows all objects that are marked as dirty. This is called automatically by the application server and need not be explicitly called.
Yote::ObjProvider::stow_all;
AUTHOR
Eric Wolf
LICENSE AND COPYRIGHT
Copyright (C) 2012 Eric Wolf
This module is free software; it can be used under the same terms as perl itself.