1Data::Stag::Writer(3) User Contributed Perl DocumentationData::Stag::Writer(3)
2
3
4
6 Data::Stag::Writer - base class for all Writers
7
9 # Abstract class - do not use directly
10 package MyOutputter;
11 use base qw(Data::Stag::Writer);
12
13 sub e_foo {
14 my ($self, $foo) = @_;
15 $self->writef("data1: %s\n", $foo->get_data1);
16 return;
17 }
18
20 base mixin class for all writers
21
23 This inherits from L<Data::Stag::BaseHandler>
24
26 new
27
28 Title: new
29
30 Args: [fn str], [fh FILEHANDLE]
31 Return: L<Data::Stag::BaseHandler>
32 Example: $w = MyWriter->new(-fh=>$fh);
33
34 returns the tree that was built from all uncaught events
35
36 file
37
38 Title: file
39
40 Args: filename str
41 Returns: filename str
42 Example: $handler->file("my_output_file.txt");
43
44 Setting this will cause all output to be diverted to this file; the
45 file will be overwritten by default. The filehandle will not be opened
46 unless any events are thrown
47
48 For more fine-grained control, use $handler->fh()
49
50 fh
51
52 Title: fh
53
54 Args: filehandle FH
55 Returns: filehandle FH
56 Example: $handler->fh(\*STDOUT);
57
58 Gets/Sets the output filehandle for the writer
59
60 safe_fh
61
62 Title: safe_fh
63 Type: PROTECTED
64
65 Args: filehandle FH
66 Returns: filehandle FH
67 Example: $handler->fh(\*STDOUT);
68
69 As fh(), but makes sure that the filehandle is initialized
70
71 You should use this if you are overriding this class
72
73 write
74
75 Title: write
76
77 Type: PROTECTED
78 Args: message str
79 Returns:
80 Example: $self->write($stag->get_blah);
81
82 writes output
83
84 to be used by classes that subclass this one
85
86 writef
87
88 Title: writef
89
90 As write, analagous to printf
91
92 use_color
93 Usage -
94 Returns -
95 Args -
96
97
98
99perl v5.36.0 2023-01-20 Data::Stag::Writer(3)