XAO::DO::Atom - recommended base object for all XAO dynamic objects
Throwing an error from XAO object:
throw $self "method - no 'foo' parameter";
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.
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.
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.
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.
Nothing.
Copyright (c) 2002 XAO, Inc.
Andrew Maltsev <am@xao.com>.
XAO::Objects
To install XAO::Base, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XAO::Base
CPAN shell
perl -MCPAN -e shell install XAO::Base
For more information on module installation, please visit the detailed CPAN module installation guide.