YaBB3::Base - A database record backed object.


YaBB3::Base - A database record backed object.


  package SubClass;
  use base qw(YaBB3::Base);
  # Access an existing record.
  my $row = $someDatabaseGetRecordMethod(...);      # Get the fields of a database record.
  my $existing = new SubClass($row);                # Create with the record fields.
  my $field    = $existing->get_fieldName();            # Access a record field.
  # Create a new record.
  my $newvalues = {                                         # New values to commit.
      Field => "value",
  my $empty    = new SubClass;                      # An empty and uncommitted object.
  $empty->subclassCommitMethod( $newvalues);        # Use a sub-class method to commit the
                                                    # newvalues to a database record.


An object that represents a record in a database. The object can be used to query or update the current state of the record.

This class is intended only as a super-class (abstract), and should not be directly instantiated.


Creating the object

The Base object is intended to only be used as a super-class of classes that access database records. It should never be created itself. Base provides three ways to create the sub-class:

  1. An empty and uncommitted object
  2. Use the new() method with no arguments to create an uncommitted object. Normally you would add new field values to commit to the backing record.

  3. A committed object
  4. Use the new($row) method with a hash of the fields from the backing record to create a committed object through which you can access the current record field values.

  5. A clone.
  6. Use the clone() method to create a copy of an existing object.

Accessing the record

Updating the record


Use Packages

  YaBB3           $Y


  Default   $VERSION $Y

Package Fields

  $VERSION  The package version number as a float.

Package Subroutines


  \$       An object reference to the next object.

This class method provides an iterator over every object. This object is a clone from the original one (it's a proxy).

ATTENTION: while running with mod_perl this returns really ALL objects of a class - also objects created by other users!! ( if I got it right ;-) - torsten )

Object Fields


Object Methods


  $%       [Opt] Committed record fields.
  \$       A Base object reference.

Create and return a new Base object. Optionally, the current state of the object can be synchronized with the current state of the backing record by supplying a hash of the current record fields that will be loaded into the values object field hash.


  $deep    Cloning by creating a deep copy? Standard is false = shallow copy.
  \$       A Base object reference.

Create and return a new object of the object which invoked this method. It has the same field values as the caller object.


  \%        The objects instance variables

Returns the objects instance variables as hash.


  $newvalues    values to update the frontend with
  $        true if successful

THIS IS JUST AN ABSTRACT METHOD! Updates the objects data with the values in the parameter hash. Should be used after storing new values in database to update the frontend data.


Torsten Mrotz (tmrotz@yabbforum.com)

Copyright ©2000-2005, YaBB 3 Development Team. All Rights Reserved.
You may distribute this module under the terms of YaBB 3.
 YaBB3::Base - A database record backed object.