NAME

ETL::Pipeline::Output::Storage::Hash - Holds the current record in a hash

SYNOPSIS

with 'ETL::Pipeline::Output::Storage::Hash';

DESCRIPTION

This role stores the current record in a Perl hash. "write_record" in ETL::Pipeline::Output copies the information out of the hash and into permanent storage.

"process" in ETL::Pipeline wipes out the hash at the start of every input record. ETL::Pipeline::Output::Storage::Hash creates an entirely new copy. That way "write_record" in ETL::Pipeline::Output can safely store the hash reference.

METHODS & ATTRIBUTES

default_fields

This subroutine returns a hash of default fields. "new_record" initializes every new record with these values. The consuming class must define the default_fields method.

NOTE: Do not return a hash reference. Return the hash. default_fields is called in list context.

current

current is a hash reference of the current record. Fields are added using the "set" method.

field_names

field_names returns a list of the current field names. It can be used for traversing the hash.

get_value

get_value returns the value of a single field. Pass the field name (a.k.a. the hash key) as the only parameter.

this_record

this_record returns the complete record as a hash instead of a hash reference.

Called from "process" in ETL::Pipeline

new_record

new_record creates a new hash reference for "current". Every record begins empty. Fields are created through "set".

set

set adds a single field to the record. The parameters are a field name followed by one or more values. Multiple values are stored as a list reference.

SEE ALSO

ETL::Pipeline, ETL::Pipeline::Output, ETL::Pipeline::Output::UnitTest

AUTHOR

Robert Wohlfarth <robert.j.wohlfarth@vanderbilt.edu>

LICENSE

Copyright 2016 (c) Vanderbilt University

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.