---
name: "Bio::MAGE::Base"
section: "3pm"
platform: "linux"
package: "libbio-mage-perl"
version: "20030502.3-6"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Bio::MAGE::Base"
---

# Bio::MAGE::Base(3pm)

generic base class

## NAME

Bio::MAGE::Base - generic base class

## SYNOPSIS

```
  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();
```

## DESCRIPTION

The base class for all other Bio::MAGE classes

## CLASS METHODS

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.

## INSTANCE METHODS

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    :
  ```

## BUGS

Please send bug reports to the project mailing list: ()

## AUTHOR

## SEE ALSO

[**perl**(1)](/perl/1.md).
