NAME
MS::Reader::XML::CV - Base class for XML-based parsers with support for referenceableParamGroups
SYNOPSIS
package MS::Reader::Foo;
use parent MS::Reader::XML::CV;
package main;
use MS::Reader::Foo;
my $run = MS::Reader::Foo->new('run.foo');
while (my $record = $foo->next_record('bar') {
# etc
}
DESCRIPTION
MS::Reader::XML::CV
is the base class for XML-based parsers which utilize referenceableParamGroups. The class and its methods are not generally called directly, but publicly available methods are documented below.
METHODS
fetch_record
my $r = $parser->fetch_record($ref => $idx);
Takes two arguments (record reference and zero-based index) and returns a record object. The types of records available and class of the object returned depends on the subclass implementation. For the MS::Reader::XML::CV class, this method calls the parental method and then adds information specific to CV parameters.
param
use MS::CV qw/:MS/;
my ($val, $units) = $obj->param( SOME_CV );
my $val = $obj->param(
SOME_CV,
index => 2,
);
my $val = $obj->param(
SOME_CV,
index => 2,
ref => $some_ref,
);
Takes a single required argument, the CV term to be looked up. In scalar context, returns the value of the term if found or else undefined. In list context, returns the value and the units of the value. One or both items can be undefined if not found.
The method can also take two optional named arguments:
index
— the index of the parameter to retrieve. Some CV parameters can be repeated, and this option can be used to access each one. Default: 0.ref
— a hash reference pointing to an internal data structure. This is used when the CV param to be looked up is not directly attached to the object making the call, but possibly to a part of it's internal structure. Generally, this is only used in implementing class methods internally, as its use requires a knowledge of the underlying data structure.
params
use MS::CV qw/:MS/;
my @cv_ids = $obj->params;
@cv_ids = $obj->params(ref => $some_ref);
With no arguments, returns an array of CV IDs directly attached to the object (if any).
The method can also take one optional named argument:
ref
— a hash reference pointing to an internal data structure. This is used when the CV params to be listed are not directly attached to the object making the call, but possibly to a part of it's internal structure. Generally, this is only used in implementing class methods internally, as its use requires a knowledge of the underlying data structure.
CAVEATS AND BUGS
The API is in alpha stage and is not guaranteed to be stable.
Please reports bugs or feature requests through the issue tracker at https://github.com/jvolkening/p5-MS/issues.
AUTHOR
Jeremy Volkening <jdv@base2bio.com>
COPYRIGHT AND LICENSE
Copyright 2015-2016 Jeremy Volkening
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.