NAME

BoutrosLab::TSVStreamDyn::IO::Role::Dyn

SYNOPSIS

# in a Moose class definition...

my $_fields = [ qw(foo bar) ];
sub _fields { return $_fields }

with 'BoutrosLab::TSVStream::IO::Role::Dyn';

has 'foo' => ( ... );
has 'bar' => ( ... );
...

DESCRIPTION

This role provides methods to create a file/iostream reader/writer for a class, using a stream of lines with tab separated fields for each record, converting to/from an object of the class. Usually, the stream will start with an initial line that has the field names as a tab separated record.

This is essentially the same as a TSVStream::IO::Role::Fixed, but for a TSVStream::IO::Role::Dyn the list of fixed name fields (which may be empty), is followed by a dynamically determined list of extra fields. The entire stream must consistently contain the same number of fields in each record.

This role provides attributes dyn_names and dyn_values, which are both arrays of strings. dyn_names contains the names of the extra fields that follow the ones specified in _fields. This attribute will have the same list of names for every record returned from a single reader object, and should contain the same list of names for every record passed to a single writer object. dyn_values is the list of values read or to be written for each record in a stream (and these can be different, of course).

This role also provided a BUILDARGS wrapper that alows the constructor to be given field_values=>[fld1,fld2,...] instead of providing each field explicitly by name. You can either provide all of the values (both for the _fields and the dyn_fields) in this one array, or else you can provide field_values=[fid1,fld2,...] and dyn_values=>[dyn_1,dyn_2,...] as two separate arguments.

AUTHOR

John Macdonald - Boutros Lab

ACKNOWLEDGEMENTS

Paul Boutros, Phd, PI - Boutros Lab

The Ontario Institute for Cancer Research