Class::Persist::Base - base class for all Class::Persist objects
This base class implements features common to all Class::Persist objects - the accessors creation methods,
new creates and returns a new object. Any parameters are passed to the init method.
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;
}
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.
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.
Class::Persist::Base - Base class for Class::Persist
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.