MAGE::BQS(3pm)
π MAGE::BQS π
okay bestie, welcome to Bio::MAGE::BQS β a User Contributed Perl Documentation moment, and honestly? it's giving "container module" and I'm obsessed. let's get into it π
β¨ NAME β¨
Bio::MAGE::BQS β the container module for all the classes hanging out in the MAGE package: BQS. that's it, that's the name, slay π
β¨ SYNOPSIS β¨
like, here's the whole vibe in one line:
use Bio::MAGE::BQS;
that's the whole thing. short and iconic π¦
β¨ DESCRIPTION β¨
so basically this is a package module that wraps up a whole little friend group of classes inside the Bio::MAGE hierarchy πΈ these classes all belong to the BQS package of the MAGE-OM object model. no cap.
β¨ CLASSES β¨
the Bio::MAGE::BQS module is home to these Bio::MAGE classes:
BibliographicReference
just the one bestie but she's carrying the whole package π
β¨ CLASS METHODS β¨
π @class_list = Bio::MAGE::BQS::classes();
this one hands you back a list of non-fully qualified class names living in this package β meaning they don't have Bio::MAGE:: glued on the front. just the short cute names π«
π $obj = class->new(%parameters)
the new() method is literally the class constructor. the main character of constructors.
- Parameters: if you pass it a list of name/value pairs, the matching slots, attributes, or associations get their starting values set right there by the constructor β¨
- Return value: a reference to an object of the class π«Ά
- Side effects: it invokes the
initialize()method if the class defines one.
π @names = class->get_slot_names()
use get_slot_names() to pull the name of every slot defined in a given class π
NOTE: this list does not include attribute or association names. slots only, bestie.
- 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. the whole government name fr fr π
π $package_name = package_name()
returns the base package name β and by that I mean no namespace:: β of the package that contains this class π
π %assns = associations()
returns the association meta-information as a hash where the keys are the association names and the values are Association objects that carry the meta-info for that association π
β¨ INSTANCE METHODS β¨
π $obj_copy = $obj->new()
when you call new() on an existing object reference instead of a class name, it acts as a copy constructor β the new object's starting values get set to be exactly those of the existing object. it's giving twin energy π―
- Parameters: no input parameters are used in the copy constructor, the initial values are taken directly from the object to be copied.
- Return value: 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) and $obj->set_slots(\@name_list, \@value_list)
set_slots() sets a bunch of slots all at once β‘ it's got two different ways to be invoked: the first takes a named parameter list, and the second takes two array references.
- Return value: none
- Side effects: will call
croak()if aslot_nameis used that the class does not define π
π @obj_list = $obj->get_slots(@name_list)
get_slots() grabs the values of a whole bunch of slots at the same time π
- Return value: a list of instance objects
- Side effects: none π
π $val = $obj->set_slot($name,$val)
set_slot() 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)
get_slot() is used to get the values of a number of slots at the same time.
- Return value: a single slot value, or
undefif the slot has not been initialized π - Side effects: none π
π $val = $bqs->xml_lists() and $inval = $bqs->xml_lists($inval)
the unified setter/getter method for the xml_lists slot π
if $inval is specified, the setter method is invoked; with no parameters, the getter method is invoked.
- Input parameters: the optional
$invalwill invoke the setter method. - Return value: for both setter and getter, the current value of the
xml_listsslot - Side effects: none
- Exceptions: none
π $val = $bqs->tagname() and $inval = $bqs->tagname($inval)
the unified setter/getter method for the tagname slot π¦
if $inval is specified, the setter method is invoked; with no parameters, the getter method is invoked.
- Input parameters: the optional
$invalwill invoke the setter method. - Return value: for both setter and getter, the current value of the
tagnameslot - Side effects: none
- Exceptions: none
π $bqs->obj2xml($writer)
writes out this object β and every single sub-object β as XML, using the supplied $writer to do the actual XML formatting β¨ it's the delegator, the project manager, the one who makes sure everything gets written properly π
- Input parameters:
$writermust be an XML writer, e.g. an instance ofBio::MAGE::XML::Writer. It must have methods:write_start_tag(),write_end_tag(), andobj2xml(). - Return value: none
- Side effects: all writing is delegated to the
$writerβ itswrite_start_tag()andwrite_end_tag()methods are invoked with the appropriate data, and all class sub-objects of theBio::MAGE::BQSinstance will have theirobj2xml()methods invoked in turn. By allowing the$writerto do the actual formatting of the output XML, it enables the user to precisely control the format π - Exceptions: will call
croak()if no identifier has been set for theBio::MAGE::BQSinstance π
π $bqs->register($obj)
stores an object for later writing as XML π¦
- Input parameters: object to be added to the list of registered objects.
- Return value: none
- Side effects: if
$objneeds to be stored by this class, a reference will be stored in the correct XML list for this class. - Exceptions: none
β¨ SLOTS, ATTRIBUTES, AND ASSOCIATIONS β¨
in the Perl implementation of MAGE-OM classes there are three types of class data members: slots, attributes, and associations π
π SLOTS π
this API uses the term slot to mean a data member of the class that was not present in the UML model and is used mainly for internal purposes β so like, only touch it if you actually understand the inner workings of the API bestie, I'm serious π most of the time slots are used by generic methods like the ones in the XML writing and reading classes.
slots are implemented using unified getter/setter methods:
$var = $obj->slot_name();
retrieves the current value of the slot π
$new_var = $obj->slot_name($new_var);
stores $new_var in the slot β and the return value is also $new_var β¨
@names = $obj->get_slot_names()
returns the list of all slots in the class π¦
DATA CHECKING: no data type checking is made for these methods. zero. none. she does not check. π
π ATTRIBUTES AND ASSOCIATIONS π
the terms attribute and association mean data members of the class that were specified directly from the UML model π
in the Perl implementation of MAGE-OM classes, association and attribute accessors are implemented using three separate methods:
get*
retrieves the current value.
NOTE: for associations, if the association has list cardinality, an array reference is returned.
DATA CHECKING: ensure that no argument is provided.
set*
sets the current value, replacing any existing value β¨
NOTE: for associations, if the association has list cardinality, the argument must be an array reference. Because of this, you probably should be using the add* methods.
DATA CHECKING: for attributes, ensure that a single value is provided as the argument. For associations, if the association has list cardinality, ensure that the argument is a reference to an array of instances of the correct MAGE-OM class, otherwise ensure that there is a single argument of the correct MAGE-OM class.
add*
NOTE: only present in associations with list cardinality.
appends a list of objects to any values that may already be stored in the association πΈ
DATA CHECKING: ensure that all arguments are of the correct MAGE-OM class.
π GENERIC METHODS π
the unified base class of all MAGE-OM classes, Bio::MAGE::Base, provides a set of generic methods that will operate on slots, attributes, and associations π
$val = $obj->get_slot($name)
\@list_ref = $obj->get_slots(@name_list);
$val = $obj->set_slot($name,$val)
$obj->set_slots(%parameters)
$obj->set_slots(\@name_list, \@value_list)
see elsewhere in this page for a detailed description of these methods π«Ά (they're up in INSTANCE METHODS, bestie, I got you)
β¨ BUGS β¨
found a bug? π please send bug reports to the project mailing list: (mged-mage 'at' lists 'dot' sf 'dot' net) β they want to hear from you fr fr π
β¨ AUTHOR β¨
Jason E. Stewart (jasons 'at' cpan 'dot' org) π an icon, a legend, the moment.
β¨ SEE ALSO β¨
perl(1)πͺ
and that's the whole page bestie!! πβ¨ this was perl v5.32.0, dated 2020-11-27, and honestly? iconic behavior. go write some XML, you're gonna eat ππ¦π
π¦ where this page comes from
- debian bookworm: libbio-mage-perl 20030502.3-6 Β· MIT
- debian trixie: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu jammy: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu noble: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu resolute: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu stonking: libbio-mage-perl 20030502.3-6 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms