Fsdb::IO::Writer - handle formatting reading from a fsdb file (handle) or queue
$fsdb = new Fsdb::IO::Writer(-file => $filename); $fsdb = new Fsdb::IO::Writer(-header => "#fsdb -F t foo bar", -fh => $file_handle); $fsdb = new Fsdb::IO::Writer(-file => '-', -fscode => 'S', -cols => [qw(firstcol second)]);
Creates a new writer object. Always succeeds, but check the
error method to test for failure.
- other options See also the options in Fsdb::IO, including
- -file FILENAME Open and write the given filename. Special filename "-" is standard output, and files with hdfs: are written to Hadoop.
- -outputheader [now|delay|never|&format_sub]
If value is "now" (the default), the header is generated after option parsing. If "delay", it is generated on first data record output. If "never", no header is ever output, and output will then not be fsdb format. If it is a perl subroutine, then the
format_sub()is called to generate the header on the first data record output (like delay); it should return the string for the header.
documented in new
internal use only: switch from uncompressed to compressed.
internal use only: create a thunk that writes rowobjs.
internal use only; write the header.
As a side-effect, we also instantiate the _write_io_sub.
Write a "row object" to an outpu stream. Row objects are either a scalar string, for a comment or header, or an array reference for a row. This routine is the fastest way to do full-featured fsdb-formatted IO. (Although see also Fsdb::Writer::fastpath_sub.)
Write args out. Less efficient than write_row_from_aref.
Write out %h, a hash of the row fields where each key is a field name.
Check if we can do fast-path IO (header written, no errors).
Return an anonymous sub that does fast-path rowobj writes when called.
Close the file and kill the saved writer sub.
Write out $c as a comment. ($c should be just the text, without a "# " header or a newline trailer.
Write out $c as raw output, typically because it's a comment that already has a "#" in front and a newline at the rear.
Returns a string representing double-space-separated, formatted version of the hash'ed fields stored in %data, listed in @fields. (This routine is a hack, there needs to be a FsdbWriter to do this properly, but there isn't currently.