NAME
Tree::Persist::Base - The base class for the Tree persistence plugin hierarchy
SYNOPSIS
See "SYNOPSIS" in Tree::Persist or scripts/xml.demo.pl for sample code.
DESCRIPTION
This provides a useful baseclass for all the Tree::Persist plugins.
Existing plugins are:
PARAMETERS
Parameters are used in the call to "connect({%opts})" in Tree::Persist or "create_datastore({%opts})" in Tree::Persist.
These are the parameters provided for by this class. These are in addition to whatever parameters sub-classes may use.
autocommit (optional)
This will be the initial setting for the autocommit value. (Please see "autocommit([$autocommit])" for more info.)
class (optional)
This is the class that will be used to bless the nodes into, unless the datastore specifies otherwise. It will default to 'Tree'.
tree (required when calling create_datastore(), not used when calling connect() )
This is the object of type Tree which is the root of the tree to write to the store.
METHODS
new({%opts})
This is the constructor. %opts
is the set of parameters as described above. Sub-classes may add their own optional or mandatory parameters.
End-user code never calls new(). You always call "connect({%opts})" in Tree::Persist or "create_datastore({%opts})" in Tree::Persist
autocommit([$autocommit])
Here, [] indicate an optional parameter.
If called without any parameters, this will return the current autocommit setting. If called with a parameter, it will set the autocommit flag to the truth value of the parameter, then return the old setting.
Autocommit, if turned on, will write any changes made to the tree directly to the datastore. If it's off, you will have to explicitly issue a commit.
NOTE: If you turn autocommit off, then back on, it will not issue a commit until the next change occurs. At that time, it will commit all changes that have occurred since the last commit.
commit()
If any changes are queued up, this will write them to the database. If there are no changes, this is a no-op.
rollback()
If there are any changes queued up, this will discard those changes and reload the tree from the datastore. If there are no changes, this is a no-op.
tree()
This will return the tree that is being persisted.
CODE COVERAGE
Please see the relevant section of Tree::Persist.
SUPPORT
Please see the relevant section of Tree::Persist.
AUTHORS
Rob Kinyon <rob.kinyon@iinteractive.com>
Stevan Little <stevan.little@iinteractive.com>
Thanks to Infinity Interactive for generously donating our time.
Co-maintenance since V 1.01 is by Ron Savage <rsavage@cpan.org>. Uses of 'I' in previous versions is not me, but will be hereafter.
COPYRIGHT AND LICENSE
Copyright 2004, 2005 by Infinity Interactive, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.