Bio::Root::Object 1.4 review
DownloadBio::Root::Object is a core Perl 5 object. SYNOPSIS # Use this module as the root of your inheritance tree. Object Creation
|
|
Bio::Root::Object is a core Perl 5 object.
SYNOPSIS
# Use this module as the root of your inheritance tree.
Object Creation
require Bio::Root::Object;
$dad = new Bio::Root::Object();
$son = new Bio::Root::Object(-name => 'Junior',
-parent => $dad,
-make => 'full');
See the new() method for a complete description of parameters. See also the USAGE section .
Bio::Root::Object attempts to encapsulate the "core" Perl5 object: What are the key data and behaviors ALL (or at least most) Perl5 objects should have?
Rationale
Use of Bio::Root::Object.pm within the Bioperl framework facilitates operational consistency across the different modules defined within the Bio:: namespace. Not all objects need to derive from Bio::Root::Object.pm. However, when generating lots of different types of potentially complex objects which should all conform to a set of basic expectations, this module may be handy.
At the very least, this module saves you from re-writing the new() method for each module you develop. It also permits consistent and robust handling of -tag => value method arguments via the Bio::Root::RootI::_rearrange() method and provides a object-oriented way handle exceptions and warnings via the Bio::Root::Root::throw() and Bio::Root::Root::warn() methods.
See the APPENDIX section for some other handy methods.
Fault-Tolerant Objects
A major motivation for this module was to promote the creation of robust, fault-tolerant Perl5 objects. The Bio::Root::Root::throw() method relies on Perl's built-in eval{}/die exception mechanism to generate fatal exceptions. The data comprising an exception is managed by the Bio::Root::Err.pm module, which essentially allows the data thrown by a die() event to be wrapped into an object that can be easily examined and possibly re-thrown.
The intent here is three-fold:
1 Detailed error reporting.
Allow objects to report detailed information about the error condition (who, what, where, why, how).
2 Handle complex errors in objects.
The goal is to make it relatively painless to detect and handle the wide variety of errors possible with a complex Perl object. Perl's error handling mechanism is a might clunky when it comes to handling complex errors within complex objects, but it is improving.
3 Efficient & easy exception handling.
To enable robust exception handling without incurring a significant performance penalty in the resulting code. Ideally, exception handling code should be transparent to the cpu until and unless an exception arises.
These goals may at times be at odds and we are not claiming to have achieved the perfect balance. Ultimately, we want self- sufficient object-oriented systems able to deal with their own errors. This area should improve as the module, and Perl, evolve. One possible modification might be to utilize Graham Barr's Error.pm module or Torsten Ekedahl's Experimental::Exception.pm module (see "Other Exception Modules").
Technologies such as these may eventually be incorporated into future releases of Perl. The exception handling used by Bio::Root::Object.pm can be expected to change as Perl's exception handling mechanism evolves.
TERMINOLOGY NOTE: In this discussion and elsewhere in this module, the terms "Exception" and "Error" are used interchangeably to mean "something unexpected occurred" either as a result of incorrect user input or faulty internal processing.
Requirements:
Perl
Bio::Root::Object 1.4 search tags