GSP
Quick Navigator

Search Site

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

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Prophet::Record(3) User Contributed Perl Documentation Prophet::Record(3)

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.

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.

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.

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.

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.

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.

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

This is a convenience method around "set_props".

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.

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

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)

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.

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

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.

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

Returns true on completion.

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.
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.
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.

Example:

'%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.

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

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.

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

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

  • Jesse Vincent <jesse@bestpractical.com>
  • Chia-Liang Kao <clkao@bestpractical.com>
  • Christine Spang <christine@spang.cc>

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 <https://rt.cpan.org/Public/Dist/Display.html?Name=Prophet>.

  • Alex Vandiver <alexmv@bestpractical.com>
  • Casey West <casey@geeknest.com>
  • Cyril Brulebois <kibi@debian.org>
  • Florian Ragwitz <rafl@debian.org>
  • Ioan Rogers <ioanr@cpan.org>
  • Jonas Smedegaard <dr@jones.dk>
  • Kevin Falcone <falcone@bestpractical.com>
  • Lance Wicks <lw@judocoach.com>
  • Nelson Elhage <nelhage@mit.edu>
  • Pedro Melo <melo@simplicidade.org>
  • Rob Hoelz <rob@hoelz.ro>
  • Ruslan Zakirov <ruz@bestpractical.com>
  • Shawn M Moore <sartak@bestpractical.com>
  • Simon Wistow <simon@thegestalt.org>
  • Stephane Alnet <stephane@shimaore.net>
  • Unknown user <nobody@localhost>
  • Yanick Champoux <yanick@babyl.dyndns.org>
  • franck cuny <franck@lumberjaph.net>
  • robertkrimen <robertkrimen@gmail.com>
  • sunnavy <sunnavy@bestpractical.com>
2022-04-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

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