BoutrosLab::TSVStream::IO::Role::Fixed
# in a Moose class definition... use MooseX::ClassAttribute class_has '_fields' => ( is => 'ro', isa => 'ArrayRef', default => sub { [qw(foo bar)] } ); # # or, without using MooseX::ClassAttribute # my $_fields = [ qw(foo bar) ]; # sub _fields { return $_fields } with 'BoutrosLab::TSVStream::IO::Role::Fixed'; has 'foo' => ( ... ); has 'bar' => ( ... ); ...
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 role is also provided a BUILDARGS wrapper that alows the constructor to be given one element pair in the parameter list: (field_values=>[val1,val2,...]) instead of providing each field explicitly by name as (fld1=>val1, fld2=>val2, ...). In such a case, the values in the field_values array must be in the same order as they are listed in the _fields class attribute.
John Macdonald - Boutros Lab
Paul Boutros, Phd, PI - Boutros Lab
The Ontario Institute for Cancer Research
To install BoutrosLab::TSVStream, copy and paste the appropriate command in to your terminal.
cpanm
cpanm BoutrosLab::TSVStream
CPAN shell
perl -MCPAN -e shell install BoutrosLab::TSVStream
For more information on module installation, please visit the detailed CPAN module installation guide.