1Fsdb::IO::Writer(3)   User Contributed Perl Documentation  Fsdb::IO::Writer(3)
2
3
4

NAME

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