NAME

XAO::DO::Atom - recommended base object for all XAO dynamic objects

SYNOPSIS

Throwing an error from XAO object:

throw $self "method - no 'foo' parameter";

DESCRIPTION

Provides some very basic functionality and common methods for all XAO dynamic objects.

Atom (XAO::DO::Atom) was introduced in the release 1.03 mainly to make error throwing uniform in all objects. There are many objects currently not derived from Atom, but that will eventually change.

All new XAO dynamic object should use Atom as their base if they are not already based on dynamic object.

METHODS

new (%)

Generic new - just stores everything that it gets in a hash. Can be overriden if an object uses something different then a hash as a base or needs a different behavior.

objname

Returns the shorthand objname that was passed to XAO::Objects->new() when creating this object. It is not the same as the fully qualified class name.

throw ($)

Helps to write code like:

sub foobar ($%) {
   my $self=shift;
   my $args=get_args(\@_);

   my $id=$args->{id} || throw $self "foobar - no 'id' given";
   ...
}

It is recommended to always use text messages of the following format:

"function_name - error description starting with a lowercase letter"
or
"- error description starting with a lowercase letter"
or
"(arg1,arg2) - error description"

There is no need to print class name, it will be prepended to the front of your error message automatically. If the message starts with '- ' or '(' then the function name is taken from the stack and added automatically too.

EXPORTS

Nothing.

AUTHOR

Copyright (c) 2002 XAO, Inc.

Andrew Maltsev <am@xao.com>.

SEE ALSO

XAO::Objects