NAME

Data::Record::Serialize::Role::Sink::Stream - output encoded data to a stream.

VERSION

version 2.01

SYNOPSIS

with 'Data::Record::Serialize::Role::Sink::Stream';

DESCRIPTION

A Moo::Role which provides the underlying support for stream sinks. Data::Record::Serialize::Role::Sink::Stream outputs encoded data to a file handle.

OBJECT ATTRIBUTES

output

One of the following:

  • The name of an output file (which will be created). If it is the string -, output will be written to the standard output stream. Must not be the empty string.

  • a reference to a scalar to which the records will be written.

  • a GLOB (i.e. \*STDOUT), or a reference to an object which derives from IO::Handle (e.g. IO::File, FileHandle, etc.). These will not be closed upon destruction of the serializer or when the "close" method is called.

fh

The file handle to which the data will be output

_passed_fh

Will be true if "output" was not a file name.

create_output_dir

Boolean; if true, the directory which will contain the output file is created. Defaults to false.

CLASS METHODS

new

This role adds two named arguments to the constructor, "output" and "fh", which mirror the added object attributes.

METHODS

close

$obj->close( ?$in_global_destruction );

Close the object; useful in destructors. Only files created by the serializer will be closed. If a filehandle, GLOB, or similar object is passed via the constructor's "output" parameter "close" method is called.

INTERNALS

SUPPORT

Bugs

Please report any bugs or feature requests to bug-data-record-serialize@rt.cpan.org or through the web interface at: https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Record-Serialize

Source

Source is available at

https://gitlab.com/djerius/data-record-serialize

and may be cloned from

https://gitlab.com/djerius/data-record-serialize.git

SEE ALSO

Please see those modules/websites for more information related to this module.

AUTHOR

Diab Jerius <djerius@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory.

This is free software, licensed under:

The GNU General Public License, Version 3, June 2007