The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

POE::Component::MessageQueue::Statistics::Publish - Base Statistics Publish Class

METHODS

new(%args)

Creates a new instance. You must pass in an instance of POE::Component::MessageQueue::Statistics, and an output destination

# initialized elsewhere
my $stats   = POE::Component::MessageQueue::Statistics->new;

my $publish = POE::Component::MessageQueue::Statistics::Publish::YAML->new(
	output => \*STDERR,
	statistics => $stats,
	interval => 10, # dump every 10 seconds
);

publish()

Publishes the current state of the statistics. This is actually a dispatcher that dispatches to the appropriate method calls (described below) that are specific to a particular output type.

Your subclass should implement the appropriate methods (output types) that you want to support.

publish_file($filename)

Receives a filename to dump the statistics.

publish_handle($handle)

Receives a handle to dump the statistics.

publish_code($code)

Receives a subroutine reference. Your code should simply pass the result output to $code and execute it:

sub publish_code
{
	my ($self, $code) = @_;
	my $output = ....; # generate output here
	$code->( $output );
}

SEE ALSO

POE::Component::MessageQueue::Statistics, POE::Component::MessageQueue::Statistics::Publish::YAML

AUTHOR

Daisuke Maki <daisuke@endeworks.jp>