NAME

Oak::Object - Base for all Oak Perl Object Tree

HIERARCHY

Oak::Object

DESCRIPTION

This is the base object for all the Oak Project, it implements a set of primary functions, that will provide the main functionallity of all Oak objects.

PROPERTIES

__CLASSNAME__

The name of the class of the object (needed by the automated creation)

METHODS

Oak::Object implements the following methods

new(PARAMS)

This method should not be overriden by any module. It calls constructor passing all the parameters it received and then calls after_construction and returns the object reference. This method also creates a mandatory property __CLASSNAME__, that will be used in the internals of Oak.

constructor(PARAMS)

This method is called automatically from new. You should not call it unless you know what you are doing. The return of this function is not checked. If you want to raise an error use throw (see Error).

MUST CALL SUPER IN THE FUNCTION IF YOU OVERRIDES IT

after_construction

This method is called just after constructor. The return of this function will be treated in the same way of constructor.

MUST CALL SUPER IN THE FUNCTION IF YOU OVERRIDES IT

message(MESSAGE)

Receives MESSAGE and execute some action associated with that message. Abstract in Oak::Object, but you can override it to provide new message handlers. But remember to call SUPER always you override this function.

assign(OBJECT)

Assign all OBJECT properties to this object

get_property_array

Returns an array with all existent properties. Actually, it really uses keys of the hash $self->{__properties__}.

get(NAME,NAME,...)

Returns a scalar if one parameter is passed, or an array if more. Do not override this function, override get_hash instead, this function is only a wraper.

get_hash(NAME,NAME,...)

Retuns a hash with all the properties requested. This function is called by get.

set(NAME=>VALUE,NAME=>VALUE,...)

Sets a property in the object. Returns true if success.

hierarchy_tree

Returns an array containing the tree of inheritance of the actual object. Including the actual object. Nice to determine the path where the object searches for methods.

instance_of(CLASS)

Tests if this object or any of its superclasses is a instance of CLASS

DESTROY

Always you implement DESTROY function, remember to call SUPER.

EXCEPTION HANDLING

Oak uses the module Error to handle the exceptions with the syntax try/throw/catch/except/otherwise/finally. And in this case all the errors must be classes. And this module introduces some (for now, just one :).

Oak::Error::ParamsMissing

This class is used in the constructors if the required params were not passed.

EXAMPLES

use base qw(Oak::Object);

COPYRIGHT

Copyright (c) 2001 Daniel Ruoso <daniel@ruoso.com> Aguimar Mendonca Neto <aguimar@email.com.br> All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.