Provided by: libbio-mage-perl_20030502.3-5_all
Bio::MAGE::Base - generic base class
use Bio::MAGE::Base; # create an empty instance my $obj = Bio::MAGE::Base->new(); # create an instance and populate with data my $obj = Bio::MAGE::Base->new(attr1=>$val1, attr2=>$val2); # copy an existing instance my $obj_copy = $obj->new();
The base class for all other Bio::MAGE classes
The following methods can all be called without first having an instance of the class via the Namespace::Class->methodname() syntax, i.e. the class name must be given as an argument to the method. $obj = class->new(%params) The "new()" method is the class constructor. Parameters: if given a list of name/value parameters the corresponding slots, attributes, or associations will have their initial values set by the constructor. Return value: It returns a reference to an object of the class. Side effects: It invokes the "initialize()" method if it is defined by the class. The following methods can all be called with either the Namespace::Class->methodname() and $obj->methodname() syntaxes. @names = get_slot_names() The "get_slot_names()" method is used to retrieve the name of all slots defined for a given object. NOTE: the list of names does not include attribute or association names. Return value: A list of the names of all slots defined for this class. Side effects: none @name_list = get_attribute_names() returns the list of attribute data members for this class. @name_list = get_association_names() returns the list of association data members for this class. @class_list = get_superclasses() returns the list of superclasses for this class. @class_list = get_subclasses() returns the list of subclasses for this class. $name = class_name() Returns the full class name for this class. $package_name = package_name() Returns the base package name (i.e. no 'namespace::') of the package that contains this class. %assns = associations() returns the association meta-information in a hash where the keys are the association names and the values are "Association" objects that provide the meta-information for the association.
These methods must be invoked with the direct object syntax using an existing instance, i.e. $object->method_name(). $obj_copy = $obj->new() When invoked with an existing object reference and not a class name, the "new()" method acts as a copy constructor - with the new object's initial values set to be those of the existing object. Parameters: No input parameters are used in the copy constructor, the initial values are taken directly from the object to be copied. Return value: It returns a reference to an object of the class. Side effects: It invokes the "initialize()" method if it is defined by the class. $obj->set_slots(%parameters) $obj->set_slots(\@name_list, \@value_list) The "set_slots()" method is used to set a number of slots at the same time. It has two different invocation methods. The first takes a named parameter list, and the second takes two array references. Return value: none Side effects: will call "croak()" if a slot_name is used that the class does not define. $obj->get_slots(@name_list) The "get_slots()" method is used to get the values of a number of slots at the same time. Return value: a list of instance objects Side effects: none $val = $obj->set_slot($name,$val) The "set_slot()" method sets the slot $name to the value $val Return value: the new value of the slot, i.e. $val Side effects: none $val = $obj->get_slot($name) The "get_slot()" method is used to get the values of a number of slots at the same time. Return value: a single slot value, or undef if the slot has not been initialized. Side effects: none throw Title : throw Usage : Function: Example : Returns : Args : throw_not_implemented Title : throw_not_implemented Usage : Function: Example : Returns : Args :
Please send bug reports to the project mailing list: ()