1Fsdb::IO::Writer(3) User Contributed Perl Documentation Fsdb::IO::Writer(3)
2
3
4
6 Fsdb::IO::Writer - handle formatting reading from a fsdb file (handle)
7 or queue
8
9 new
10 $fsdb = new Fsdb::IO::Writer(-file => $filename);
11 $fsdb = new Fsdb::IO::Writer(-header => "#fsdb -F t foo bar",
12 -fh => $file_handle);
13 $fsdb = new Fsdb::IO::Writer(-file => '-',
14 -fscode => 'S',
15 -cols => [qw(firstcol second)]);
16
17 Creates a new writer object. Always succeeds, but check the "error"
18 method to test for failure.
19
20 Options:
21
22 other options See also the options in Fsdb::IO, including "-file",
23 "-header".
24 -file FILENAME Open and write the given filename. Special filename "-"
25 is standard output, and files with hdfs: are written to Hadoop.
26 -outputheader [now|delay|never|&format_sub]
27 If value is "now" (the default), the header is generated after
28 option parsing. If "delay", it is generated on first data record
29 output. If "never", no header is ever output, and output will then
30 not be fsdb format. If it is a perl subroutine, then the
31 "format_sub()" is called to generate the header on the first data
32 record output (like delay); it should return the string for the
33 header.
34
35 config_one
36 documented in new
37
38 _enable_compression
39 $self->_enable_compression
40
41 internal use only: switch from uncompressed to compressed.
42
43 create_io_subs
44 $self->create_io_subs($with_compression)
45
46 internal use only: create a thunk that writes rowobjs.
47
48 write_headerrow
49 internal use only; write the header.
50
51 As a side-effect, we also instantiate the _write_io_sub.
52
53 write_rowobj
54 $fsdb->write_rowobj($rowobj);
55
56 Write a "row object" to an outpu stream. Row objects are either a
57 scalar string, for a comment or header, or an array reference for a
58 row. This routine is the fastest way to do full-featured fsdb-
59 formatted IO. (Although see also Fsdb::Writer::fastpath_sub.)
60
61 write_row_from_aref
62 $fsdb->write_row_from_aref(\@a);
63
64 Write @a.
65
66 write_row
67 $fsdb->write_row($a1, $a2...);
68
69 Write args out. Less efficient than write_row_from_aref.
70
71 write_row_from_href
72 $fsdb->write_row_from_href(\%h);
73
74 Write out %h, a hash of the row fields where each key is a field name.
75
76 fastpath_ok
77 $fsdb->fastpath_ok();
78
79 Check if we can do fast-path IO (header written, no errors).
80
81 fastpath_sub
82 $fsdb->fastpath_sub()
83
84 Return an anonymous sub that does fast-path rowobj writes when called.
85
86 close
87 $fsdb->close;
88
89 Close the file and kill the saved writer sub.
90
91 write_comment
92 $fsdb->write_comment($c);
93
94 Write out $c as a comment. ($c should be just the text, without a "# "
95 header or a newline trailer.
96
97 write_raw
98 $fsdb->write_raw($c);
99
100 Write out $c as raw output, typically because it's a comment that
101 already has a "#" in front and a newline at the rear.
102
103 format_fsdb_fields
104 format_fsdb_fields(\%data, \@fields)
105
106 Returns a string representing double-space-separated, formatted version
107 of the hash'ed fields stored in %data, listed in @fields. (This
108 routine is a hack, there needs to be a FsdbWriter to do this properly,
109 but there isn't currently.
110
111
112
113perl v5.30.1 2020-01-30 Fsdb::IO::Writer(3)