Bric - The Bricolage base class.
Release Version: 1.6.14
File (CVS) Version:
$Revision: 1.35.2.23 $
$Date: 2004/04/11 15:30:41 $
use base qw( Bric );
The Bric class is an abstract class should never be used directly. Instead new classes should be derived from it.
Call this constructor from all derived classes. This sets up some basic fields and methods.
Throws:
NONE
Side Effects
NONE
Notes:
NONE
This method is similar to the 'new' method except it is used only to retrieve a already existing object of this type from the database whereas 'new' creates a new, empty object. All subclasses should override this method in order to look up their objects in the database. However, they must first call cache_lookup() to see if it can retrieve the object from the cache. If they can, they should simply return the object. Otherwise, once they look up the object in the database, they should cache it via the cache_me() method. For example:
sub lookup {
my $pkg = shift;
my $self = $pkg->cache_lookup(@_);
return $self if $self;
# ... Continue to look up object in the database. Then...
$self->cache_me;
}
Throws:
lookup method not implemented.
Side Effects NONE.
Notes: NONE.
Looks up an object in the cache and returns it if it exists. Otherwise it returns an undefined value. This method is meant to be used by Bric subclasses in their lookup() methods. See lookup() for an example.
Throws: NONE.
Side Effects NONE.
Notes: NONE.
This is an abstract method. All derived classes should override this method. In the concrete implementations of this method, classes should also call cache_me() for every object to be returned.
Throws:
list method not implemented.
Side Effects NONE.
Notes: NONE.
This is an abstract method. All derived classes should override this method. This method returns a list of IDs rather than objects.
Throws:
list_ids method not implemented
Side Effects NONE.
Notes: NONE.
This function is used by sub classes to register their field names and assign access levels to them.
Throws:
Unable to register field names.
Side Effects: Defines a subroutine named ACCESS() in the caller's package.
Notes: NONE.
This is the default destructor method. Even if nothing is defined within it, it should still be here so that Perl wont waste time trying to find it in the AUTOLOAD section.
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Uses confess rather than die to report errors.
Throws:
Its a 'thrower'.
Side Effects
Halts program execution
Notes:
Uses cluck rather than warn to output warnings.
Throws:
Its a 'thrower'.
Side Effects
Outputs a warning message
Notes:
NONE.
This is the AUTOLOAD handler. It translates all set and get operations into subroutines acting upon the fields in derived classes.
Throws:
Bad AUTOLOAD method format.
Cannot AUTOLOAD private methods.
No AUTOLOAD method.
Access denied: '$field' is not a valid field for package '$package'
Can't locate object method via package.
Side Effects
Creates a custom subroutine reference in the calling packages namespace
Notes:
Return a list of IDs for the Bric::Util::Grp objects to which the object belongs. When called as a class method, return the value of the class' INSTANCE_GROUP_ID constant.
Throws:
NONE
Side Effects:
NONE
Notes:
NONE
Caches the object for later retrieval by the lookup() class method. Should be called for all object retrieved from the database. That includes all objects to be returned by lookup(), list(), and href() methods.
Throws: NONE.
Side Effects NONE.
Notes: NONE.
Add the current object to the appropriate group in the database. These are groups that contain every instance of a particular type of object.
Throws:
NONE
Side Effects:
NONE
Notes:
NONE
Add the current object to the appropriate group in the database. These are groups that contain every instance of a particular type of object.
Throws:
NONE
Side Effects:
NONE
Notes:
NONE
Save the current object to the database.
Throws:
NONE
Side Effects:
NONE
Notes:
NONE
Get and set the _dirty field
Throws: NONE.
Side Effects NONE.
Notes: NONE.
The internal function used to set field values. Can be called with either a hash reference of keys and their corresponding values, or as two array references, one containing all the keys, the other containing all the values
Throws:
Incorrect number of args to _set().
Error setting value in _set().
Side Effects NONE.
Notes: NONE.
The internal function used to get field values. It accepts a list of key values to retrieve from the object.
Throws:
Problems retrieving field 'foo'
Side Effects
NONE
Notes:
Error checking and exception throwing is only performed in QA_MODE for performance reasons.
The internal function used to get field values and return them as an arrayref. It accepts a list of key values to retrieve from the object.
Throws:
NONE
Side Effects
NONE
Notes:
Garth Webb <garth@perijove.com>
Sam Tregar <stregar@about-inc.com>
Copyright (c) 2001 About.com. Changes Copyright (c) 2002-2003 Kineticode, Inc. and others. See Bric::License for complete license terms and conditions.