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