oid

A UUID that uniquely identifies this object in the world. It would be bad to change this unless you know what you are doing. It's probably bad even if you do know what you're doing.

mk_accessors

set( column => value, [ column => value ... ] )

get( column )

NAME

Class::Persist::Base - Base class for Class::Persist

DESCRIPTION

This is a useful thing to inherit from - it gives you accessors, a new / init method that will initialise the object, emit/throw/record methods for throwing errors, and does the right thing when accessors don't return true values.

METHODS

new( key => value, key => value, ... )

new creates and returns a new object. Any parameters are passed to the init method.

init

the init method is called by new() after it creates an object. The init assumes the passed parameters are a hash, takes the keys, and calls the methods with the names of the keys, passing the values. The common use for this is to pass initial values for all the accessor methods when calling new():

my $object = Your::Subclass->new( foo => 'bar' );

override the init method in your subclass if you need to perform setup, but remember to call the init method of the superclass first, and return undef if it fails:

sub init {
  my $self = shift;
  $self->SUPER::init(@_) or return;

  ...
  return 1;
}

EO will complain if the init call is not passed up to the superclass.

Return 1 to indicate your init was successful, and the new method will return the object. Returning a false value will cause new() to fail.