Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  PROPHET::RECORD (3)

.ds Aq ’


Prophet::Record - Base class for records.



version 0.751


This class represents a base class for any record in a Prophet database.



Returns a sorted list of the names of the record’s declared properties. Declared properties are always validated even if the user provides no value for that prop. This can be used for such things as requiring records to have certain props in order to be created, for example.


Returns the record’s type.

register_reference CW$class, CW$accessor, CW$foreign_class, CW@args

Registers a reference to a foreign class to this record. The foreign class must be of type Prophet::Collection or Prophet::Record, or else a fatal error is triggered.

register_collection_reference CW$accessor, CW$collection_class, by => CW$key_in_model

Registers and creates an accessor in the current class to the associated collection $collection_class, which refers to the current class by $key_in_model in the model class of $collection_class.

register_record_reference CW$accessor, CW$record_class, by => CW$key_in_model

Registers and creates an accessor in the current class to the associated record $record_class, which refers to the current class by $key_in_model in the model class of $collection_class.

create { props => { CW%hash_of_kv_pairs } }

Creates a new Prophet database record in your database. Sets the record’s properties to the keys and values passed in.

Automatically canonicalizes and then validates the props.

Upon successful creation, returns the new record’s uuid. In case of failure, returns undef.

load { uuid => CW$UUID } or { luid => CW$UUID }

Given a UUID or LUID, look up the LUID or UUID (the opposite of what was given) in the database. Set this record’s LUID and UUID attributes, and return the LUID or UUID (whichever wasn’t given in the method call).

Returns undef if the record doesn’t exist in the database.

set_prop { name => CW$name, value => CW$value }

Updates the current record to set an individual property called $name to $value

This is a convenience method around set_props.

    set_props { props => { key1 => val1, key2 => val2} }

Updates the current record to set all the keys contained in the props parameter to their associated values. Automatically canonicalizes and validates the props in question.

In case of failure, returns false.

On success, returns true.


Returns a hash of this record’s properties as currently set in the database.


When called on a loaded record, returns true if the record exists and false if it does not.

prop CW$name

Returns the current value of the property $name for this record. (This is a convenience method wrapped around get_props).

delete_prop { name => CW$name }

Deletes the current value for the property $name. (This is currently equivalent to setting the prop to ’’.)


Deletes this record from the database. (Note that it does _not_ purge historical versions of the record)

changesets { limit => CW$int }

Returns an ordered list of changeset objects for all changesets containing changes to the record specified by this record object.

Note that changesets may include changes to other records.

If a limit is specified, this routine will only return that many changesets, starting from the changeset containing the record’s creation.


Returns an ordered list of all the change objects that represent changes to the record specified by this record object.

uniq CW@list

The List::MoreUtils::uniq function (taken from version 0.21).

Returns a new list by stripping duplicate values in @list. The order of elements in the returned list is the same as in @list. In scalar context, returns the number of unique elements in @list.

    my @x = uniq 1, 1, 2, 2, 3, 5, 3, 4; # returns 1 2 3 5 4
    my $x = uniq 1, 1, 2, 2, 3, 5, 3, 4; # returns 5

validate_props CW$propsref

Takes a reference to a props hash and validates each prop in the hash or in the PROPERTIES attribute that has a validation routine (validate_prop_$prop).

Dies if any prop fails validation. Returns true on success. Returns false if any prop is not allowable (prop name fails validation).


A hook to allow forcing users to only use certain prop names.

Currently just returns true for all inputs.

canonicalize_props CW$propsref

Takes a hashref to a props hash and canonicalizes each one if a canonicalize_prop_$prop routine is available.

Returns true on completion.

default_props CW$props_ref

Takes a reference to a hash of props and looks up the defaults for those props, if they exist (by way of default_prop_$prop routines). Sets the values of the props in the hash to the defaults.


Default the creator of every record to the changeset_creator (usually the current user’s email address.)


Default the original_replica of every record to the replica’s uuid.

validate_prop_from_recommended_values ’prop’, CW$argsref

Checks to see if the given property has a valid value and returns true if so. If not, adds an error message to $argsref->{errors}{prop} and returns false.

    recommended_values_for_prop ’prop’

Given a record property, return an array of the values that should usually be associated with this property.

If a property doesn’t have a specific range of values, undef is returned.

This is mainly intended for use in prop validation (see validate_prop_from_recommended_values). Recommended values for a prop are set by defining methods called _recommended_values_for_prop_$prop in application modules that inherit from Prophet::Record.


A string of the default summary format for record types that do not define their own summary format.

A summary format should consist of format_string,field pairs, separated by | characters.

Fields that are not property names must start with the $ character and be handled in the atom_value routine.


%s,$luid | %s,summary | %s,status


Tries to find the summary format for the record type. Returns _default_summary_format if nothing better can be found.

    _atomize_summary_format [$format]

Splits a summary format into pieces (separated by arbitrary whitespace and the | character). Returns the split list.

If no summary format is supplied, this routine attempts to find one by calling _summary_format.


Parses the summary format for this record’s type (or the default summary format if no type-specific format exists).

Returns a list of hashrefs to hashes which contain the following keys: format, prop, value, and formatted

(These are the format string, the property to be formatted, the value of that property, and the atom formatted according to format_atom, respectively.)

If no format string is supplied in a given format atom, %s is used.

If a format atom $value’s value does not start with a $ character, it is swapped with the value of the prop $value (or the string (no value).

All values are filtered through the function atom_value.


Returns a formatted string that is the summary for the record. In an array context, returns a list of

atom_value CW$value_in

Takes an input value from a summary format atom and returns either its output value or itself (because it is a property and its value should be retrieved from the props attribute instead).

For example, an input value of $uuid would return the record object’s uuid field.

format_atom CW$string => CW$value

Takes a format string / value pair and returns a formatted string for printing. Dies with a message if there’s an error in the format string that sprintf warn()s on.


Finds the luid for the records uuid, or creates a new one. Returns the luid.


Returns this record’s changesets as a single string.


Returns a list of method names that refer to other individual records


Returns a list of method names that refer to collections

new { handle => Prophet::Replica, type => CW$type }

Instantiates a new, empty Prophet::Record of type $type.


o Jesse Vincent <>
o Chia-Liang Kao <>
o Christine Spang <>


This software is Copyright (c) 2009 by Best Practical Solutions.

This is free software, licensed under:

  The MIT (X11) License


You can make new bug reports, and view existing ones, through the web interface at <>.


o Alex Vandiver <>
o Casey West <>
o Cyril Brulebois <>
o Florian Ragwitz <>
o Ioan Rogers <>
o Jonas Smedegaard <>
o Kevin Falcone <>
o Lance Wicks <>
o Nelson Elhage <>
o Pedro Melo <>
o Rob Hoelz <>
o Ruslan Zakirov <>
o Shawn M Moore <>
o Simon Wistow <>
o Stephane Alnet <>
o Unknown user <nobody@localhost>
o Yanick Champoux <>
o franck cuny <>
o robertkrimen <>
o sunnavy <>
Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 PROPHET::RECORD (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.