Bric::Util::Class(3)

NAME
Bric::Util::Class - A module to provide access to the class table

VERSION
$LastChangedRevision$

DATE
$LastChangedDate: 2004-09-14 02:48:55 +0200 (Tue, 14 Sep 2004) $

SYNOPSIS
 use Bric::Util::Class;

DESCRIPTION
Provides access to the class table that maps package names to a display name and description.

INTERFACE

  Constructors

$obj = Bric::Util::Class->new($init);
    Keys for $init are:

    •   key_name

        A lowercase unique key name for the class with no spaces or punctuation, such as 'user_grp'.

    •   pkg_name

        The full package name of this class, such as 'Bric::Util::Grp::User'.

    •   disp_name

        The way the package name (usually shortened) should be displayed on the UI, such as 'User Group'.

    •   plural_name

        The plural form of disp_name.

    •   description

        A description of this package.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$obj = Bric::Util::Class->lookup({ id => $id });
$obj = Bric::Util::Class->lookup({ pkg_name => $pkg_name });
$obj = Bric::Util::Class->lookup({ key_name => $key_name });
    Retrieves an existing class record from the database.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

@objs = Bric::Util::Class->list($param);
    The possible keys to $param are the following:

    disp_name
    plural_name
    description

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$objs_href = Bric::Util::Class->pkg_href();
    Returns an anonymous hash of all the class objects in Bricolage. The hash keys are the lower-cased package names for each class, and the values are the Bric::Util::Class objects themselves.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$objs_href = Bric::Util::Class->id_href();
    Returns an anonymous hash of all the class objects in Bricolage. The hash keys are the object IDs for each class, and the values are the Bric::Util::Class objects themselves.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$objs_href = Bric::Util::Class->key_href();
    Returns an anonymous hash of all the class objects in Bricolage. The hash keys are the lower-cased key names for each class, and the values are the Bric::Util::Class objects themselves.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

  Destructors

$p->DESTROY
    Dummy method to prevent wasting time trying to AUTOLOAD DESTROY.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

  Public Class Methods

$meths = Bric::Util::Class->my_meths
(@meths || $meths_aref) = Bric::Util::Class->my_meths(TRUE)
my (@meths || $meths_aref) = Bric::Util::Class->my_meths(0, TRUE)
    Returns an anonymous hash of introspection data for this object. If called with a true argument, it will return an ordered list or anonymous array of introspection data. If a second true argument is passed instead of a first, then a list or anonymous array of introspection data will be returned for properties that uniquely identify an object (excluding "id", which is assumed).

    Each hash key is the name of a property or attribute of the object. The value for a hash key is another anonymous hash containing the following keys:

    name
        The name of the property or attribute. Is the same as the hash key when an anonymous hash is returned.

    disp
        The display name of the property or attribute.

    get_meth
        A reference to the method that will retrieve the value of the property or attribute.

    get_args
        An anonymous array of arguments to pass to a call to get_meth in order to retrieve the value of the property or attribute.

    set_meth
        A reference to the method that will set the value of the property or attribute.

    set_args
        An anonymous array of arguments to pass to a call to set_meth in order to set the value of the property or attribute.

    type
        The type of value the property or attribute contains. There are only three types:

        short
        date
        blob
    len If the value is a 'short' value, this hash key contains the length of the field.

    search
        The property is searchable via the list() and list_ids() methods.

    req The property or attribute is required.

    props
        An anonymous hash of properties used to display the property or attribute. Possible keys include:

        type
            The display field type. Possible values are

            text
            textarea
            password
            hidden
            radio
            checkbox
            select
        length
            The Length, in letters, to display a text or password field.

        maxlength
            The maximum length of the property or value - usually defined by the SQL DDL.

    rows
        The number of rows to format in a textarea field.

    cols
        The number of columns to format in a textarea field.

    vals
        An anonymous hash of key/value pairs reprsenting the values and display names to use in a select list.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

  Public Instance Methods

$success = $key->save;
    Save changes to the database.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

PRIVATE METHODS

  Private Class Methods
NONE

  Private Instance Methods
Need documenting.

_select_class
_update_class
_insert_class

NOTES
NONE

AUTHOR
Garth Webb <garth@perijove.com>

SEE ALSO
perl, Bric