NAME
Data::Stag::Writer - base class for all Writers
SYNOPSIS
# Abstract class - do not use directlypackage MyOutputter;use base qw(Data::Stag::Writer);sub e_foo {my ($self, $foo) = @_;$self->writef("data1: %s\n", $foo->get_data1);return;}
DESCRIPTION
base mixin class for all writers
INHERITANCE
This inherits from L<Data::Stag::BaseHandler>
PUBLIC METHODS -
new
Title: newArgs: [fn str], [fh FILEHANDLE]Return: L<Data::Stag::BaseHandler>Example: $w = MyWriter->new(-fh=>$fh);
returns the tree that was built from all uncaught events
file
Title: fileArgs: filename strReturns: filename strExample: $handler->file("my_output_file.txt");
Setting this will cause all output to be diverted to this file; the file will be overwritten by default. The filehandle will not be opened unless any events are thrown
For more fine-grained control, use $handler->fh()
fh
Title: fhArgs: filehandle FHReturns: filehandle FHExample: $handler->fh(\*STDOUT);
Gets/Sets the output filehandle for the writer
safe_fh
Title: safe_fhType: PROTECTEDArgs: filehandle FHReturns: filehandle FHExample: $handler->fh(\*STDOUT);
As fh(), but makes sure that the filehandle is initialized
You should use this if you are overriding this class
write
Title: writeType: PROTECTEDArgs: message strReturns:Example: $self->write($stag->get_blah);
writes output
to be used by classes that subclass this one
writef
Title: writef
As write, analogous to printf
use_color
Usage -Returns -Args -